Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Heroku postgres unique constraint error

I have a local sqlite db that was created using the knex library. It runs perfectly fine on my local machine.

I deployed the same knex syntax on heroku but under postgres however I get the error:

error: alter table "dAppTable" add constraint 
"dapptable_dappname_unique" unique ("dAppName") - column "dAppName" 
named in key does not exist

This is unusual as the table is clearly stated below:

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');
    })
};

Here is the connection config file, production is used:

production: {
    client: 'postgresql',
    connection: process.env.DATABASE_URL,
    pool: {
        min: 2,
        max: 10
    },
    migrations: {
        tableName: 'dAppTable',
        directory: __dirname + '/migrations'
    },
    seeds: {
        directory: __dirname + '/seeds'
    }
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!