The problem is sometimes a specific column becomes empty or null for no reason, the column is "link_status", follow the code bellow.
"typeorm": "^0.2.40"
useFactory: async () =>
await createConnection({
type: 'mysql',
host: process.env.DB_HOST,
port: 3306,
username: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_DATABASE,
entities: [Link, LinkPayment, LinkPaymentStatus, LinkItems],
synchronize: true,
}),
@Entity('link')
export class Link extends BaseEntity {
@PrimaryGeneratedColumn()
link_id: number
@Column()
patient_id: number
@Column({ length: 9 })
link_status: string
@Column({ length: 45 })
token: string
@Column({ length: 100 })
link_url: string
@Column()
created_at: Date
@Column()
expiry_at: Date
@Column()
updated_at: Date
}
The problem is when I change my branch to a version which doesn't have the column in the entity and synchronize
is true
they turn all rows in this column Empty because that column doesn't exist.
A simple misunderstand in the configuration and usage...