This project is archived and is in readonly mode.
[patch] Unique index name for schema_migrations table
Reported by Rudolf Gavlas | July 12th, 2009 @ 03:19 PM | in 3.x
In environment where two rails projects coexist within one database, we need to use unique name of index of "schema_migrations" table. Since we now support unique name of "schema_migrations" table only using "Base.table_name_prefix" and "Base.table_name_suffix", the same should be sufficient for the "unique_schema_migrations" index.
Postgresql complaints ERROR: relation
"unique_schema_migrations" already exists'' if there is already a
rails project in the database (with different table names
prefix).
Patch for activerecord is attached.
(Also please see the ticket #2751, where
Christoph fixes a slightly-related table name
'schema_migrations' is hard coded'' problem in activerecord's
"lib/active_record/schema_dumper.rb" file.)
Comments and changes to this ticket
-
Pratik July 14th, 2009 @ 12:55 PM
LH seems to be messing up the attachments lately. Could you please reupload the patch ?
Thanks.
-
Rudolf Gavlas July 14th, 2009 @ 03:08 PM
Sure. I'll also paste it here verbatim, it is not big at all. I am hitting another LH bug probably -- I can't open the page with formatting help right now, so here it is FWIW just pasted without any formatting:
--- lib/active_record/connection_adapters/abstract/schema_statements.rb-orig 2009-07-12 15:47:09.000000000 +0200 +++ lib/active_record/connection_adapters/abstract/schema_statements.rb 2009-07-12 15:48:39.000000000 +0200 @@ -321,7 +321,7 @@
schema_migrations_table.column :version, :string, :null => false end add_index sm_table, :version, :unique => true,
-
:name => 'unique_schema_migrations'
-
:name => Base.table_name_prefix + 'unique_schema_migrations' + Base.table_name_suffix # Backwards-compatibility: if we find schema_info, assume we've # migrated up to that point:
-
-
Rudolf Gavlas October 9th, 2009 @ 08:28 PM
Now I noticed ticket #1543, which makes this one a duplicate. This problem report can be closed.
-
Dan Pickett May 9th, 2010 @ 07:04 PM
- Assigned user set to Ryan Bigg
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>