Marcus Andersson
2006-Mar-16 10:16 UTC
[Rails] Use Migrations in modules in separate source trees?
We have a scenario where we have a core engine with module add-ons. What modules that will be used differ from deployment to deployment. Each of these modules might need different things in the db (both structure and data) and I want each module to be in charge of its own db structure. Each module is contained in its own source directory and what modules to use is determined in the build process (each module has it''s own build script (with some inherited from a "main" build script) and I want db scripts to be executed in this process). I really like Migrations and would like to use it. Is it possible to use in a scenario like this? What do I need to do in order to make it work (if possible)? Keep in mind that all modifications from all modules goes into the same database and that the order of how the module build scripts are executed might vary from deployment to deployment so the numbering scheme and schema_info table might be troublesome in this case. I guess I need to be able to get a module name/code into it somewhere somehow. Any answers/ideas appreciated! /Marcus
James Adam
2006-Mar-16 10:50 UTC
[Rails] Use Migrations in modules in separate source trees?
You should look at the migrations stuff in Rails Engines - you might find you can use this straight out of the box. If you treat each one of your ''modules'' as an engine, you''ll have access to the migrations in each module and the ability to migrate individual modules up and down as necessary. http://rails-engines.org http://api.rails-engines.org/engines/ (section ''Migrating Engines'') - james On 3/16/06, Marcus Andersson <m-lists@bristav.se> wrote:> We have a scenario where we have a core engine with module add-ons. What > modules that will be used differ from deployment to deployment. Each of > these modules might need different things in the db (both structure and > data) and I want each module to be in charge of its own db structure. > Each module is contained in its own source directory and what modules to > use is determined in the build process (each module has it''s own build > script (with some inherited from a "main" build script) and I want db > scripts to be executed in this process). > > I really like Migrations and would like to use it. Is it possible to use > in a scenario like this? What do I need to do in order to make it work > (if possible)? Keep in mind that all modifications from all modules goes > into the same database and that the order of how the module build > scripts are executed might vary from deployment to deployment so the > numbering scheme and schema_info table might be troublesome in this > case. I guess I need to be able to get a module name/code into it > somewhere somehow. > > Any answers/ideas appreciated! > > /Marcus > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- * J * ~