0

Hi guys can you help me with my problem, somebody experienced db-migrate up for posgre here that nothing happens after using use command db-migrate up

$ db-migrate up add-terminal-business-addr

terminal screenshot

Database config:

{
  "dev": {
    "driver": "pg",
    "user": "postgres",
    "password": "",
    "host": "localhost",
    "port": "5432",
    "database": "postgres"
  }
}

database config screenshot

'use strict'

var dbm;
var type;
var seed;

/**
  * We receive the dbmigrate dependency from the dbmigrate initially.
  * This enable us to not have to rely on NODE_PATH.
  */
export.setup = function(options, seedLink) {
  dbm = options.dbmigrate;
  type = options.dataType;
  seed = seedLink;
};

export.up = function(db) {
  return db.removeColumn('terminals', 'business_address');
};

export.down = function(db) {
  return db.addColumn('terminals', 'business_address', {type: 'jsonb', notNull: false});
};

export._meta = {
  "version": 1;
};

Migration file screenshot

thoroc
  • 3,291
  • 2
  • 27
  • 34
Irish John
  • 11
  • 1
  • Would be nice to have text instead of screenshots. These are likely to vanish in the future. – thoroc Oct 12 '22 at 14:58

1 Answers1

0

Well the problem might be :

problem with just the version of db-migrate-pg


OR

In production or having important data in development you should take time to investigate the issue. In this case you most likely had created an empty migration, ran rake db:migrate, then added instructions to the migration, so you don't see a new field and further rake db:migrate does nothing. To resolve this issue you need to comment your change instructions, perform rake db:rollback, uncomment instructions and then rake db:migrate to apply instructions you missed.

Try to rebuild your database structure(WARNING: all db-data will be lost):

rake db:drop:all
rake db:create:all
rake db:migrate

If you use Rails < 4.1, don't forget to prepare test database:

rake db:test:prepare

This is the easiest solution since you are working with tutorial.

ADITYA AHLAWAT
  • 140
  • 1
  • 13