This project is archived and is in readonly mode.

#1739 ✓invalid
Gaius Centus Novus

schema_migrations.version is an INTEGER in test db

Reported by Gaius Centus Novus | January 12th, 2009 @ 07:42 PM | in 2.x

On MySQL, I'm getting a strange bug in test, but not in dev. I can run rake db:migrate or rake db:schema:load just fine.

In test, I get "Mysql::Error: Duplicate entry '2147483647' for key 1: INSERT INTO ts_schema_migrations (version) VALUES ('20081008010000')."

On further investigation, the version column in ts_schema_migrations in my dev database is a VARCHAR(255). In the test database, it's an INTEGER.

WHY???!?!?!?!?

Comments and changes to this ticket

  • Pratik

    Pratik March 13th, 2009 @ 11:08 AM

    • State changed from “new” to “invalid”
    • Assigned user set to “Pratik”

    You should submit a failing test or a patch - http://guides.rails.info/contrib...

    Thanks !

  • Ben Woosley

    Ben Woosley August 5th, 2010 @ 08:56 PM

    • Tag changed from 2.1.1, migrations, schema to 2.1.1, 2.3.5, migrations, schema
    • Importance changed from “” to “”

    I ran into the same problem in 2.3.5, and it seems to be an issue with the prefix, as it was resolved once I dropped the prefix and monkey-patched the migrator to look for the prefix-less schema_migrations table. e.g:

    module ActiveRecord
      class Migrator
        class << self
          def schema_migrations_table_name
            return 'schema_migrations' if Base.connection.table_exists?('schema_migrations')
            Base.table_name_prefix + 'schema_migrations' + Base.table_name_suffix
          end
        end
      end
    end
    

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>

People watching this ticket

Pages