Comments (4)
@cyberdelia did you mean to add it to the template spec_helper? I think it's a good idea as well, I can add that check
I believe we have two options here, use the Sequel default error message
Sequel::Migrator.check_current(DB, "#{Config.root}/db/migrate")
$ rake [ruby-2.2.1]
rake aborted!
Sequel::Migrator::NotCurrentError: migrator is not current
/Users/dyego/.rvm/gems/ruby-2.2.1/gems/sequel-4.24.0/lib/sequel/extensions/migration.rb:368:in `check_current'
/Users/dyego/code/magenta/spec/spec_helper.rb:11:in `<top (required)>'
/Users/dyego/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1280:in `require'
...
Tasks: TOP => default => spec
(See full trace by running task with --trace)
Or check if it's current and fail with our own error message
unless Sequel::Migrator.if_current(DB, "#{Config.root}/db/migrate")
fail "Our own error message"
end
Do you think we need a custom message or Sequel's default is fine?
from pliny.
I would rather have the migration applied rather than just a check, but that could be a could be a good first step.
from pliny.
I like the idea, yet I'm reluctant to running the migrations automatically. If we do, then what should we do with the -development
database? Often you'll also want your tests to pass, even though you haven't migrated the database. The example I'm thinking here is where you have deployed things, but migrations haven't run yet.
I think the nice thing to do here is to give a warning. What do you think?
from pliny.
The main goal would be to avoid running tests against an outdated schema. What we currently do is:
begin
require "sequel/extensions/migration"
Sequel::Migrator.check_current(Sequel::Model.db, 'db/migrate')
rescue Sequel::Migrator::Error
abort("Test database is not up-to-date, please run: bundle exec rake db:setup")
end
from pliny.
Related Issues (20)
- RFC: Add app_name and source to default config HOT 6
- RFC: website documentation HOT 14
- The PLINY_ENV default bubbles to RACK_ENV HOT 4
- Default migrate task does not clear active databases
- update PRMD dependency HOT 8
- Default Rollbar reporting approach is unsafe HOT 3
- schema outputted from generating scaffold doesn't do irregular plurals correctly HOT 1
- heroku instructions? HOT 2
- Swagger/OpenAPI vs prmd? HOT 9
- pliny-update copies raw erb files HOT 2
- Make use of APP_ENV HOT 1
- Recommended Approach for Pliny App with no DB HOT 4
- No rubocop rake task on deploy HOT 2
- A fresh pliny project without models won't start HOT 4
- More flexibility in initializers to avoid duplication in `puma.rb`
- Add serializer information to canonical log lines HOT 1
- Error during update from 0.25.0 to 0.25.1 HOT 2
- Feedback Request: Expose application to seeds
- Gem "oj" 3.0 breaks "encode" HOT 12
- Add zulu time formatting helpers HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pliny.