BlueHotDog / sails-migrations

The missing, migrations, arm of the octopus
MIT License
157 stars 36 forks source link

Simple table creation migration does not create table #62

Closed bwestergard closed 8 years ago

bwestergard commented 9 years ago

Running the following migration creates the sails_migrations table, adds a row to it, but does not create the inventoryAccounts table. Perhaps I'm missing something obvious...

'use strict';

exports.up = function(knex, Promise) {
  knex.schema.createTable('inventoryAccounts', function (table) {
    table.increments();
    table.text('name');
    table.text('slug');
    table.boolean('allowNegativeBalance');
  });
};

exports.down = function(knex, Promise) {
  knex.schema.dropTable('inventoryAccounts');
};
plasticut commented 9 years ago

I suppose you must return promise from up and down functions

'use strict';

exports.up = function(knex, Promise) {
  return knex.schema.createTable('inventoryAccounts', function (table) {
    table.increments();
    table.text('name');
    table.text('slug');
    table.boolean('allowNegativeBalance');
  });
};

exports.down = function(knex, Promise) {
  return knex.schema.dropTable('inventoryAccounts');
};
RWOverdijk commented 8 years ago

@plasticut is right. It returns a promise, which must be returned.