I see. Ok, I see a couple of options here.  Some of which have been
suggested already.

1. Rip out (svn remove) the migrations you don't want. Reset the db.
2. Add new migrations to add/fix/remove the changes.
3. db:migrate down to the lowest possible version, comment out the the
guts of the migrations you don't want. Then migrate back up.
4. Something entirely different that I can't think of right now:)


Which approach you should take depends on a couple of factors ... such
as ... whether the app is in production yet, how much code and tests
are affected, how true to the "rails way" you want to stay ... things
like that.

Good luck with it.


On 12/3/08, Shantanu Pavgi <[EMAIL PROTECTED]> wrote:
>
> Well, I need to remove some database tables from my application. So I am
> using rake db:migrate:down to undo/remove migrations. Also, I have
> changed (added/removed/modified) the code in model, view, controller,
> and tests to make these changes. Now I need to run tests in order to
> check everything is working.
>
> I can pull out an old copy from revision control system. But, what if
> migrations that need to be removed are not the latest ones. Lets assume
> that there are 30
> migrations.
> - migration # 15 and 17 - are related to adding new tables
> - migration # 22 and 25 - add column to above tables.
>
> So I need to remove/undo migrations 15, 17, 22, and 25.  I need other
> migrations as they are not related to these tables. What should I do in
> such situation?
>
> I did db:migrate:down for above migrations and also made necessary
> changes in the code and now trying to run tests. Am I following wrong
> approach?
>
> Thanks,
> Shantanu.
>
> James Mitchell wrote:
>> That's an unusual question. The reason you have tests is to verify
>> your code actually does what you think it's doing. If you migrate
>> down, you add and/or remove model attributes, which (hopefully) your
>> code depends on. And your tests should fail if you change that. That
>> is, if your code doesn't break just trying to run the tests.
>>
>> Are your trying to run a prior version of your app?  If so, you should
>> use your revision control system to pull down an older copy of the
>> code and db:reset.
>>
>> HTH
>>
>>
>> On 12/3/08, Shantanu Pavgi <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> >
>>>
>>
>>
>> --
>>
>> --
>> James Mitchell
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 

--
James Mitchell

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to