1

I was trying to run a migration file to create a table of users but I kept getting the following error:

Error: Not run migration 1604169742656_add-users-table is preceding already run migration 1604024614269_table-comments

I worked around it by creating a new database as I was pressed for time, but does anyone know what the interpretation of this error is? Did I need to first perform a drop of the current table?

This is the migration I was trying to run:

exports.up = pgm => {
  pgm.sql(`
    CREATE TABLE users (
      id SERIAL PRIMARY KEY,
      created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
      bio VARCHAR(400),
      username VARCHAR(30) NOT NULL
    );
  `);
};
Daniel
  • 281
  • 2
  • 3
  • 15

1 Answers1

1

Was able to solve this issue by adding the --no-check-order flag to my command. Found it here.

So something like node-pg-migrate up --no-check-order 1604169742656_add-users-table

cweave
  • 126
  • 1