我正在使用dbdiff npm软件包来比较两个数据库的架构。当我插入两个模式时,将得到未定义的输出。 diff.compareSchemas()也不会让我使用.then语句,可能是因为输出未定义。我不确定我需要做什么才能使输出成为未定义的内容。
const dbdiff = require('dbdiff'),
diff = new dbdiff.DbDiff(),
schema = [];
(async () => {
await dbdiff.describeDatabase({
dialect: 'mysql',
username: 'root',
password: 'redacted',
database: 'redacted',
host: 'localhost',
dialectOptions: {
ssl: false
}
}).then((res) => {
schema[0] = res;
});
await dbdiff.describeDatabase({
dialect: 'mysql',
username: 'root',
password: 'redacted',
database: 'redacted',
host: 'localhost',
dialectOptions: {
ssl: false
}
}).then((res) => {
schema[1] = res;
});
const schemaDiff = await diff.compareSchemas(schema[0], schema[1])
console.log(diff.commands('drop'));
console.log(schemaDiff);
})();