Fifigyuri wrote: > Hi, > > I have a little dilemma where and how to place a script in my > rails application. I work on a reimplementation and the original > database structure is changed. The old data needs to be migrated into > a new schema. The migration is executed very few times, maybe just > once. As the data set might be huge, I also do not wish to execute it > often. > Currently I placed the script in dir /script, but I think it does > not fit the place well, it is meant for other things... isn't it? I > think it should among the migrations, but I don't want it to be > executed always as the others migration when the data model is > created.
The preferred way to create the DB is to use rake db:schema:load. Migrations are only for migration. So just write the script as a migration. That's what migrations are for. > Could you give me advice, how to tackle elegantly this thing? I > want to keep my code in the rails project structure, although it will > be executed few times, maybe only now. And I'd like to have it at a > place which it fits well. Thanks for help! > You are describing a classic use case for a migration. There's no reason to do it any other way. If you're worried about it being run when it shouldn't be, just throw in some if statements. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] > Georg -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---

