nodejh / sequelize-automate

Automatically generate bare sequelize models from your database.
MIT License
116 stars 22 forks source link

A model that generates only one table #30

Closed qq578023708 closed 4 years ago

qq578023708 commented 4 years ago

I want to generate only a database table model, how to do it

nodejh commented 4 years ago

You can use options.tables.

For example:

// sequelize-automate.config.js
module.exports = {
  dbOptions: {
    database: "test",
    username: "root",
    password: "root",
    dialect: "mysql",
    host: "localhost",
    port: 3306,
    logging: false
  },
  options: {
    type: "js",
    dir: "models",
    tables: [ 'user' ], // array of table names that you want to generate
 }
}

Then

$ sequelize-automate -c "./sequelize-automate.config.js"
qq578023708 commented 4 years ago

Thank you. I'll try