Open fortezhuo opened 2 years ago
BaseModel.ts
import { CreatedAt, UpdatedAt, Model, Column, DeletedAt, } from "sequelize-typescript" export class BaseModel<T extends Model<T>> extends Model<T> { @CreatedAt _createdAt: Date @Column _createdBy: string @UpdatedAt _updatedAt: Date @Column _updatedBy: string @DeletedAt _deletedAt?: Date }
And while we create User that extends BaseModel
class User extends BaseModel<User> { @Column(DataType.TEXT) firstName: string @Column(DataType.TEXT) lastName: string @Column(DataType.TEXT) fullName: string }
The columns will be generated with order like this
id _createdBy _updatedBy firstName lastName fullName _createdAt _updatedAt _deletedAt
How to create class User that order like
id firstName lastName fullName _createdBy _updatedBy _createdAt _updatedAt _deletedAt
My question on top of this exact issue would be how do you change column order without changing your model
Any updates? I also encountered this problem.
Issue
BaseModel.ts
And while we create User that extends BaseModel
Versions
Issue type
Actual behavior
The columns will be generated with order like this
Expected behavior
How to create class User that order like