You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the command bin/rake db:schema:load with my structure.sql will fail with confusing errors, because my structure.sql file does not work when it's run twice.
I discovered these two lines below cause the db:schema:load task to be defined twice in rake, and thus rake executes them twice.
I finally figured this out. The issue boils down to incompatibility with the strong_migrations gem. Here's a very simple Rakefile to reproduce the issue.
require'rails'# need to make sure defined?(Rails) is true for strong_migrationsrequire'strong_migrations'require'standalone_migrations'StandaloneMigrations::Tasks.load_tasks
strong_migrations through a series of require s calls load "active_record/railties/databases.rake".
I've noticed that when I have a simple
Rakefile
like thisRunning the command
bin/rake db:schema:load
with mystructure.sql
will fail with confusing errors, because mystructure.sql
file does not work when it's run twice.I discovered these two lines below cause the
db:schema:load
task to be defined twice in rake, and thus rake executes them twice.standalone-migrations/lib/standalone_migrations/tasks.rb
Line 14 in b136d01
standalone-migrations/lib/standalone_migrations/tasks.rb
Line 22 in b136d01
I was able to prevent it locally with the following monkey patch.
According to rake, executing tasks twice when defining them twice is intended behaviour: ruby/rake#228 (comment)
The text was updated successfully, but these errors were encountered: