Closed tobalsgithub closed 10 years ago
What timing. @chadxz just added migrating: true
to the config when Grunt lifts sails, which was released in @0.4.0.
You should be able to use that, and just if (!sails.config.migrating)
in your bootstrap. Let me know if you run into any problems with that workaround!
Awesome sauce. Thanks.
I'm running into an interesting situation. I'm trying to seed data into the database in the config/bootstrap.js file. This was recommended by a number of folks as the best way to handle seed data.
When running grunt db:migrate:up, sails-db-migrate lifts the sails server, which calls the bootstrap.js file, which starts trying to seed my data into the database that hasn't had the migrations run on it yet.
I'm wondering what you think a good solution for this might be. I've thought of a couple things.
Sails.lift({ port: -1, log: {level: 'silent'}, environment: env, migrating: true}, ...
. This way in bootstrap.js I can choose not to insert my seed data if the server is just getting lifted for migrations.I'm open to other ideas as well, and definitely willing to help with a pull request. Let me know what you think might work best.