diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-07 23:25:50 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-07 23:25:50 +0000 |
commit | 869a172a8a6e2d2182f16e959f4a41fa10df133a (patch) | |
tree | c80b73f14dbb1d40e556bb849b7ec5384b3ecd5d /activerecord/test/migration_test.rb | |
parent | c7df5bd6ac256cf75631f8c59c1de1f96df02b17 (diff) | |
download | rails-869a172a8a6e2d2182f16e959f4a41fa10df133a.tar.gz rails-869a172a8a6e2d2182f16e959f4a41fa10df133a.tar.bz2 rails-869a172a8a6e2d2182f16e959f4a41fa10df133a.zip |
Migrations: raise if a column is duplicated. Closes #7345.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6961 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/migration_test.rb')
-rw-r--r-- | activerecord/test/migration_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index d1e2059c9a..fa765a7017 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -807,6 +807,22 @@ if ActiveRecord::Base.connection.supports_migrations? end end + def test_should_disallow_duplicate_column_definition + assert_raises(ActiveRecord::StatementInvalid) do + Person.connection.add_column("people", "full_name", :string, :limit => 40) + Person.connection.add_column("people", "full_name", :text) + end + + assert_raises(RuntimeError) do + Person.connection.create_table :people_with_errors do |t| + t.column "full_name", :string, :limit => 40 + t.column "full_name", :text + end + end + + Person.reset_column_information + end + end end |