0
nodejsのnpm-migrationが新しく、すべてのテーブルを作成するための複数の移行ではなく、1回の移行で複数のテーブルを作成しようとしています。 私はこの試みている:あなたがここに私の文を見たい場合は、あなたがnodejs npm-migration 1回の移行で複数のテーブルを作成する
module.exports = {
"up":
function(pool, cb){
pool.multipleStatements = true;
var query =
company_type_up +
company_up;
pool.query(query, function(err, res){
cb();
});
},
"down":
function(pool, cb){
var query =
company_down + company_type_down;
pool.query(query, function(err, res){
cb();
});
},
}
:
var company_type_up =
"CREATE TABLE company_type(" +
"_id VARCHAR(36) NOT NULL PRIMARY KEY, " +
"name VARCHAR(60), " +
"description VARCHAR(500) " +
"); ";
var company_type_down =
"DROP TABLE company_type; ";
var company_up =
"CREATE TABLE company(" +
"_id VARCHAR(36) NOT NULL PRIMARY KEY, " +
"name VARCHAR(60), " +
"description VARCHAR(500), " +
"country VARCHAR(100), " +
"state VARCHAR(100), " +
"city VARCHAR(100), " +
"address VARCHAR(300), " +
"phone1 VARCHAR(60), " +
"phone2 VARCHAR(60), " +
"email VARCHAR(100), " +
"tax_name VARCHAR(300), " +
"tax_number VARCHAR(200), " +
"firm_name VARCHAR(300)" +
"); ";
var company_down =
"DROP TABLE company; ";