This project is archived and is in readonly mode.

#1210 open
Gaius Centus Novus

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

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>

Attachments

Pages