我正在尝试找出在迁移时将sequelize预先添加到我的SQL查询表名之前的原因public
,我认为这与我看到SequelizeDatabaseError: relation "public.organization" does not exist
的原因直接相关。 organization
是表的名称,因此迁移不应该成为问题,但是public
似乎确实是在先挂起并抛出原始SQL的后继。
"sequelize": "^3.19.2",
"sequelize-cli": "2.7.0",
这是迁移文件:
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('organization', 'admin_id');
},
down: function (queryInterface, Sequelize) {
return queryInterface.removeColumn('organization', 'admin_id',{
type: Sequelize.INTEGER,
before: "admin"
});
}
};
这是错误的截断版本:
name: 'SequelizeDatabaseError',
message: 'relation "public.organization" does not exist',
parent:
{ error: relation "public.organization" does not exist
...
sql: 'ALTER TABLE "public"."organization" ADD COLUMN "admin_id" INTEGER;' },