mattangriffel
mattangriffel

Reputation: 839

How to Reverse a Migration that Requires a Gem

I recently tested the Queue_Classic gem in my app. Part of the setup is running this migration:

require 'queue_classic'

class AddQueueClassic < ActiveRecord::Migration
  def self.up
    QC::Setup.create
  end

  def self.down
    QC::Setup.drop
  end
end

Now I'd like to switch to a different queueing system, but I'm afraid that I won't be able to remove queue_classic from the Gemfile. Even if I generate a migration that just runs:

drop_table :queue_classic_jobs

Won't rake db:migrate still complain when it sees the first instance of require 'queue_classic' and QC::Setup.create but can't find the queue_classic gem?

Upvotes: 0

Views: 187

Answers (2)

Michael Durrant
Michael Durrant

Reputation: 96484

Create the migration to do QC::Setup.drop and run it.

Then delete the original AddQueueClassic migration altogether.

Upvotes: 1

phoet
phoet

Reputation: 18845

yeah, that is true. that's the case why, at some point, you just get rid of old migrations and use the schema.rb http://adventuresincoding.com/2010/02/how-to-clean-up-your-activerecord-migrations

Upvotes: 1

Related Questions