mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:39:53 +01:00
create timestamp function + sequences on test schema loads too
This fixes a strange issue when running RSpec with changed migrations. Basically: `ActiveRecord::Migration.maintain_test_schema!` drops the database and wants to apply the schema from the `schema.rb` again, but that fails at creating the `answers` table since it can't find the postgres function `gen_timestamp_id`. Internally it just calls `bin/rails db:test:load_schema`, so I just hook it in the same way I do it for `db:schema:load` (used by `db:setup` ...)
This commit is contained in:
parent
452c71c128
commit
60a8e3ac7d
1 changed files with 4 additions and 0 deletions
4
Rakefile
4
Rakefile
|
@ -467,8 +467,12 @@ namespace :db do
|
|||
|
||||
# create timestampid before loading schema
|
||||
Rake::Task['db:schema:load'].enhance ['db:schema:create_timestampid_function']
|
||||
Rake::Task['db:test:load_schema'].enhance ['db:schema:create_timestampid_function']
|
||||
# create id_sequences after loading schema
|
||||
Rake::Task['db:schema:load'].enhance do
|
||||
Rake::Task['db:schema:create_id_sequences'].invoke
|
||||
end
|
||||
Rake::Task['db:test:load_schema'].enhance do
|
||||
Rake::Task['db:schema:create_id_sequences'].invoke
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue