TalentBox / sequel-rails

A gem for using Sequel with Rails 5.x, 6.x, 7.x, 8.x
http://talentbox.github.io/sequel-rails/
MIT License
326 stars 81 forks source link

Migration tasks do not emit helpful output #96

Open russellsilva opened 9 years ago

russellsilva commented 9 years ago

ActiveRecord rake db:migrate and friends emit output that helps developers see what the command is doing and provides context if something goes wrong. Here's a canonical example from the Ruby on Rails guide. sequel-rails migration rake tasks appear to emit no output when a command is successful and little to no contextual information when a failure occurs. I recently had failing rake db:migrate:down invocations that were not even emitting which migration file they were failing on. Could sequel-rails rake tasks provide more output?

JonathanTron commented 9 years ago

Hi @russellsilva,

thanks for raising your concerns about this, I need to check but I think there's a way to have verbose migrations from Sequel's Migrator by setting it's logger to stdout. The drawback it that it's really verbose as it outputs all the SQL being send to the db. There's no easy hook for us to filter this output once enabled, so I don't think it should be enabled by default.

I'll check what we can do about it when I have some time (hint: a PR for it would be awesome).

brauliobo commented 7 years ago

+1. rake db:migrate:down VERSION= is failing silently and I'm having to run on the console manually to see something happenning: ::Sequel::Migrator.run(::Sequel::Model.db, SequelRails::Migrations.migrations_dir, target: 20170415131036), still not working :(

brauliobo commented 7 years ago

rake db:migrate:down doesn't seem to work at all. The only way I could make something similar was to rollback all recent migrations to a previous migrations: Sequel::Migrator.apply(DB, SequelRails::Migrations.migrations_dir, 20170415130850)

gencer commented 5 years ago

padrino seems to have this wonderfully. I just executed few migration and i got INFO from Sequel. However, I am unable to achieve same task for SequelRails. I tried few workaround but it seems Sequel only sends SQL Queries. Nothing else. I cannot retrieve anything other than sql logs. Weird.

@JonathanTron, have you ever time to look at this? Sequel has a log_info method. This method feeds informational messages from few classes such as Migrations...

PikachuEXE commented 1 year ago

db:migrate:down is actually ::Sequel::Migrator.run(::Sequel::Model.db, SequelRails::Migrations.migrations_dir, opts)

Which at most rollback migrations until target (specified by VERSION) is reached

https://github.com/jeremyevans/sequel/blob/5.74.0/lib/sequel/extensions/migration.rb#L761

If running specific migration is desired a new migrator must be written

Edit 1: e.g. bundle exec rake sq:migrate:down VERSION=20231101063614 means