Node.js Heroku postgres唯一约束错误
我有一个使用knex库创建的本地sqlite数据库。它在我本地的机器上运行得非常好 我在heroku上部署了相同的knex语法,但在postgres下,我得到了错误:Node.js Heroku postgres唯一约束错误,node.js,postgresql,heroku,Node.js,Postgresql,Heroku,我有一个使用knex库创建的本地sqlite数据库。它在我本地的机器上运行得非常好 我在heroku上部署了相同的knex语法,但在postgres下,我得到了错误: error: alter table "dAppTable" add constraint "dapptable_dappname_unique" unique ("dAppName") - column "dAppName" named in key does not exist 这是不寻常的,因为下表中有明确说明: ex
error: alter table "dAppTable" add constraint
"dapptable_dappname_unique" unique ("dAppName") - column "dAppName"
named in key does not exist
这是不寻常的,因为下表中有明确说明:
exports.up = function(knex, Promise)
{
console.log('create dApp table');
return knex.schema.createTableIfNotExists('dAppTable', function(table)
{
table.increments('id');
table.string('dAppName').unique();
table.string('abi');
table.string('contractAddress').unique();
})
};
exports.down = function(knex, Promise)
{
return knex.schema.dropTableIfExists('dAppTable').then(function ()
{
console.log('dAppTable table was dropped');
})
};
这是连接配置文件,使用的是生产:
production: {
client: 'postgresql',
connection: process.env.DATABASE_URL,
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'dAppTable',
directory: __dirname + '/migrations'
},
seeds: {
directory: __dirname + '/seeds'
}
}