cli: Seed doesn't execute, marked as succeeded

I’ve been struggling with this for almost an entire day. The TL;DR is that all of the db:seed commands will execute and not throw an error when they don’t actually do anything. I’ve been pulling my hair out trying to figure out what the hell is going on but since there’s no real documentation, it’s been extremely tough.

None of the seed commands ever work. Not seed --seed, not seed:undo, not seed:all (no seeds! great!), not seed:undo:all (again there are no seeds! wat). I switched to the json seeder cache and have been manually modifying it because even though the seed doesn’t do anything it gets marked as complete.

Seeders that don’t execute should not be marked as a success. And I know it didn’t execute because I have no data in my database (I had to remove it all manually because again undo doesn’t work).

'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    return 
      queryInterface.bulkInsert('Users', [
        {email: "aphrodite@olympus.org", name: "Aphrodite",  createdAt: Date.now(), updatedAt: Date.now() },
        {email: "athena@olympus.org", name: "Athena", createdAt: Date.now(), updatedAt: Date.now() },
        {email: "zeus@olympus.org", name: "Zeus", createdAt: Date.now(), updatedAt: Date.now() },
        {email: "apollo@olympus.org", name: "Apollo", createdAt: Date.now(), updatedAt: Date.now() }
        ]
      );
  },

  down: function (queryInterface, Sequelize) {
    return 
    queryInterface.bulkDelete('Users', null, {});
  }
};

I do not have a schema. I’ve tried wrapping the returned queryInterface in an array as some Stack Overflow posts have suggested, nothing. I’ve tried {tableName: 'Users'} and nothing. I’ve tried an empty string schema, also nothing. I’ve added a {schema: 'whatever'} after the data array, nothing. I added an empty hash after the data array, nothing. So something is going on but it’s just not executing my inserts or deletes, and it’s not telling me there’s an error. Silence is the absolute worst thing.

This is with Sequelize 3.23.0, CLI 2.4.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20

Commits related to this issue

Most upvoted comments

Just curious, but is the empty space after return causing a JS bug? http://encosia.com/in-javascript-curly-brace-placement-matters-an-example/

Strange, I wonder what this means?

Executing (default): SELECT 1+1 AS result

@Americas Thanks, I thought that might be it. 😃 I actually came to this issue looking for why my seeders had stopped recording their runs in my database. What I ended up discovering is that the "seederStorage" is now none by default. I had to manually set this to "seqeulize" to make them start storing again. This is a big breaking change on a minor version increase, as my database now seeds over and over until I stop it. Could these please be major version bumps in the future?

@mtitolo This almost certainly something a linter would catch in the future. Hope that helps 😃