This project is archived and is in readonly mode.
table_name_prefix with db:schema:load causes double prefixes
Reported by Gaius Centus Novus | October 14th, 2008 @ 06:04 PM | in 2.3.10
1: set config.active_record.table_name_prefix =
'pfx_'
in /config/environment.rb
2: create some migrations. For example:
create_table :blogs do |t|
t.string :name
t.timestamps
end
3: run rake db:migrate
. The generated schema is as
follows:
create_table "pfx_blogs", :force => true do |t|
t.string "name"
t.timestamps
end
create_table "pfx_schema_migrations", :primary_key => "version", :force => true do |t|
end
add_index "pfx_schema_migrations", ["version"], :name => "unique_schema_migrations", :unique => true
4: run rake test
. The tables created by
db:schema:load
are as follows:
- pfx_schema_migrations
- pfx_pfx_schema_migrations
- pfx_pfx_blogs
Additionally, I don't know whether this is related, but under
SQLite3, I get the following on rake test
after a
rake db:migrate
:
SQLite3::SQLException: index unique_schema_migrations already exists: CREATE UNIQUE INDEX "unique_schema_migrations" ON "pfx_schema_migrations" ("version")
Comments and changes to this ticket
-
Ben Woosley July 1st, 2010 @ 11:00 PM
- Assigned user set to Pratik
- Importance changed from to
Pratik, while his "additionally" note does describe #1543, the rest does not. I can confirm the duplicate prefix from db:test:prepare is a real problem on 2.3.5 at least.
-
Pratik July 1st, 2010 @ 11:08 PM
- Assigned user cleared.
- State changed from duplicate to open
-
Neeraj Singh July 29th, 2010 @ 09:23 PM
- Milestone changed from 2.x to 2.3.9
-
DLitz December 20th, 2010 @ 08:57 PM
The problem is that the SchemaDumper isn't aware of table_name_(prefix|suffix). The attached patch against Rails 2.3.10 fixes this issue.
-
rails March 21st, 2011 @ 12:00 AM
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails March 21st, 2011 @ 12:00 AM
- State changed from open to stale
-
DLitz March 21st, 2011 @ 02:41 PM
This is a bug against 2-3-stable, not 3-0-stable, and yes it still applies.
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>