Reputation: 1967
I am using typeorm with nest.js and I have a session entity like the below
import { Column, Entity, PrimaryColumn } from 'typeorm';
@Entity('session')
export class Session {
@PrimaryColumn('varchar', { length: 255 })
sid: string;
@Column('jsonb')
sess: JSON;
@Column('timestamptz', { nullable: true })
expire: string;
}
Whenever I start the server I have enabled synchronize: true
in the configuration.
This is creating a table like the below, with id, createdAt, updatedAt being created by default even though not mentioned in the entity schema.
How to disable this default creation of (id, createdAt, updatedAt)columns and restrict the table to be created with only the columns I have mentioned in the entity?
Upvotes: 0
Views: 1171
Reputation: 2822
It's probably created by previous attempts. Try these steps to fix the issue:
npm run prebuild
npm run build
npm run start
Upvotes: 1