Sha256: 8b2be6cc8aa24bfc27ed3dbb4f507541304202b948bdd3c17a96897d3d581003
Contents?: true
Size: 794 Bytes
Versions: 3
Compression:
Stored size: 794 Bytes
Contents
command 'db:rollback' do description "Rollback the database N steps (you can specify the version with `db:rollback [STEP_COUNT]`" Rack::App::SeQueL::Runner.setup_command(self, :target) action do |step=1| step = Integer(step) if step == 0 migration_config[:target] = 0 end Rack::App::SeQueL.open_connection do |connection| row = connection[:schema_migrations] .order(Sequel.desc(:filename)) .offset(step).first unless row.nil? migration_config[:target] = Integer(row[:filename].match(/^([\d]+)/)[0]) end end unless migration_config[:target] migration_config[:target] || abort("target version not found") exit(Rack::App::SeQueL::Runner.new(options, migration_config).run) end end
Version data entries
3 entries across 3 versions & 1 rubygems