sequelize / sequelize-auto

Automatically generate bare sequelize models from your database.
2.88k stars 521 forks source link

How to generate class based model of mssql in sequelize-auto #632

Open Hammasali47 opened 1 year ago

Hammasali47 commented 1 year ago

I am using sequelize auto command like this

sequelize-auto -h -d -u -x [password] -p [port] --dialect [dialect] -c [/path/to/config] -o [/path/to/models] -t [tableName]

however sequelize-auto generate model of that table in functional form.Is there any way to generate class based model of mssql database using sequelize-auto?

abdulbari149 commented 1 year ago

Hello, You can use the --lang option to switch to es6/esm/ts to switch to the class based init method, instead of the define method.

sequelize-auto -h -d -u -x [password] -p [port] --dialect [dialect] -c [/path/to/config] -o [/path/to/models] -t [tableName] --lang es6

This will solve your problem