Replies: 2 comments 2 replies
-
I forgot to add that when I roll back the most recent git version that I pushed up to heroku, I still get that "More than 1 row in migrator table" error when I run rake db:migrate but the app works as expected. |
Beta Was this translation helpful? Give feedback.
1 reply
-
You should figure out what the correct migration version is for the current database schema (which may be different than the target version you are attempting to migrate to), then run: correct_version = some_integer
ds = DB[:schema_info]'
DB.transaction do
ds.delete
ds.insert(version: correct_version)
end |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi and thank you for this excellent software package.
I need help on troubleshooting this error. Can I make changes to the migrator table directly or is there a way to reset it using a sequel command? Thanks for any ideas.
Nick
Description follows.
I am attempting to run a migration on a production box on Heroku-22 stack, sequel 5.89.0, ruby 3.2.6
I am using the integer migrator and my migration files are sequential. Migrations are run from a rake task...
namespace :db do desc "Run migrations" task :migrate, [:version] do |t, args| require "sequel" Sequel.extension :migration db = Sequel.connect(ENV.fetch("DATABASE_URL")) if args[:version] puts "Migrating to version #{args[:version]}" Sequel::Migrator.run(db, "db/migrations", target: args[:version].to_i) else puts "Migrating to latest" Sequel::Migrator.run(db, "db/migrations") end end
Migrations have been working on Heroku and my development box up until this last batch of changes that migrated fine on development box but give me the following error when running from the Heroku CLI.
Running bundle exec rake db:migrate on ⬢ w7lt... up, run.7008
'Migrating to latest
rake aborted!
Sequel::Migrator::Error: More than 1 row in migrator table (Sequel::Migrator::Error)
/app/vendor/bundle/ruby/3.2.0/gems/sequel-5.89.0/lib/sequel/extensions/migration.rb:655:in
schema_dataset' /app/vendor/bundle/ruby/3.2.0/gems/sequel-5.89.0/lib/sequel/extensions/migration.rb:490:in
initialize'/app/vendor/bundle/ruby/3.2.0/gems/sequel-5.89.0/lib/sequel/extensions/migration.rb:550:in
initialize' /app/vendor/bundle/ruby/3.2.0/gems/sequel-5.89.0/lib/sequel/extensions/migration.rb:436:in
new'/app/vendor/bundle/ruby/3.2.0/gems/sequel-5.89.0/lib/sequel/extensions/migration.rb:436:in
run' /app/Rakefile:12:in
block (2 levels) in <top (required)>'/app/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/exe/rake:27:in
<top (required)>' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in
load'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in
kernel_load' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:23:in
run'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:492:in
exec' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/command.rb:28:in
run'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in
invoke_command' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor.rb:527:in
dispatch'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:34:in
dispatch' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/base.rb:584:in
start'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:28:in
start' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/exe/bundle:37:in
block in <top (required)>'/app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:117:in
with_friendly_errors' /app/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.22/exe/bundle:29:in
<top (required)>'/app/vendor/bundle/bin/bundle:108:in
load' /app/vendor/bundle/bin/bundle:108:in
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Beta Was this translation helpful? Give feedback.
All reactions