1
我正在構建應用程序使用節點+ express + postgresql + knexjs ORM。我試圖運行遷移:knexjs postgresql遷移未正常運行
knex migrate:latest
但我的控制檯不斷返回:
Using environment: development
Already up to date
,這導致我的表沒有被創建。這裏是我的遷移文件:
exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.createTable('address', function(table) {
table.increments();
table.string('address_id');
table.string('addr_1');
table.string('addr_2');
table.string('city');
table.string('state');
table.string('zip');
]);
};
exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.dropTable(host_domain + '.address'),
]);
};
有誰知道可能會發生什麼?
請注意 - 表格在我運行knex migrate:latest
的那一刻尚未創建。
在此先感謝!
什麼'knex_migrations'表的內容?這就是Knex跟蹤它所應用的遷移的地方。你的遷移文件是否已經在那裏? – Gangstead
沒有遷移表。根本沒有桌子 –
沒有設置遷移的聲音。你可以發佈你的knexfile嗎? – Gangstead