Open TRIS-H opened 4 years ago
假设我的表名为my_table_a, 我这样输入: sequelize-automate -h ${sql.host} -d ${sql.database} -u ${sql.username} -p ${sql.password} -P ${sql.port} -m /my_table_a/ 还是生成了全部,是哪里的问题?
瞄了下源码: const dbOptions = _.assign({}, { database: argv.d, username: argv.u, password: argv.p, dialect: argv.e, host: argv.h || '127.0.0.1', port: argv.P || getDefaultPort(argv.e), }, configFile ? configFile.dbOptions : {});
const options = _.assign({}, {
type: argv.t || 'js',
camelCase: !!argv.C,
dir: argv.o || path.resolve(${process.cwd()}/models
),
emptyDir: !!argv.r,
}, configFile ? configFile.options : {});
貌似-m并无传递
确实没有,我周末解决一下。试试用配置文件的方式?
// 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: ["my_table_a"] // 只生成 my_table_a 的 model
}
}
$ sequelize-automate -c "./sequelize-automate.config.js"
--match, -m
,值是一个正则表达式