Skip to content

Commit

Permalink
Add tests for scoping schema_migrations index by global table prefix …
Browse files Browse the repository at this point in the history
…and suffix

[#1543 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
cristibalan authored and jeremy committed Aug 10, 2009
1 parent 9e96f37 commit 25fe43b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -25,6 +25,24 @@ def puts(text="")
end
end

class MigrationTableAndIndexTest < ActiveRecord::TestCase
def test_add_schema_info_respects_prefix_and_suffix
conn = ActiveRecord::Base.connection

conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name)
ActiveRecord::Base.table_name_prefix = 'foo_'
ActiveRecord::Base.table_name_suffix = '_bar'
conn.drop_table(ActiveRecord::Migrator.schema_migrations_table_name) if conn.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name)

conn.initialize_schema_migrations_table

assert_equal "foo_unique_schema_migrations_bar", conn.indexes(ActiveRecord::Migrator.schema_migrations_table_name)[0][:name]
ensure
ActiveRecord::Base.table_name_prefix = ""
ActiveRecord::Base.table_name_suffix = ""
end
end

class MigrationTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false

Expand Down

0 comments on commit 25fe43b

Please sign in to comment.