one db - many rails projects -> many schema_migrations table

Hi all!

How can I change the name of the schema_migrations table? I have to do this because I can only use one database but want to have several rails projects. I hope this is possible at all. greets flo schaf

Interesting! Depending on which database you are using, you can explore different database schemas owned by different users within the same physical database. I know that Oracle and MySQL use different terminology to achieve the same results. Mainly, though, I recommend that you drive this differentiation by creating different schema owner accounts that have visibility to the set of common tables and hide the schema_migration table from other accounts.

Yet another approach can be to use updatable views, but that is definitely not portable and some databases may not even support it, so I will stick with the first approach. You may want to work with someone who has DBA level knowledge of the specific database that you are using. Bharat

Florian Schaf wrote:

Florian Schaf wrote: I have the same problem. Did a find a solution?

JEF

Hi,

poking round the source I see:

      def schema_migrations_table_name         Base.table_name_prefix + 'schema_migrations' + Base.table_name_suffix       end

in activerecord-2.1.0/lib/active_record/migration.rb

I suppose you could override this method in that class and then call initialize_schema_migrations_table.

Have you tried just having multiple migrations and just letting the migration code work it out for itself? Rails should handle intermediate migrations with timestamps (I think!)

Allan

poking round the source I see:

      def schema_migrations_table_name         Base.table_name_prefix + 'schema_migrations' + Base.table_name_suffix       end

I need to over write this method only for one app not for all. Is it possible to do so into the app? If so where to over_write the code?

Have you tried just having multiple migrations and just letting the migration code work it out for itself? Rails should handle intermediate migrations with timestamps (I think!)

you mean the mean the timestamps that prefixe the migrations file? I replace it by an integer.