diff options
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 3 | ||||
-rw-r--r-- | activerecord/test/migration_test.rb | 16 |
3 files changed, 1 insertions, 20 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index b480050a5f..e56b12f274 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,7 +1,5 @@ *SVN* -* Migrations: raise if a column is duplicated. #7345 [Jeremy McAnally, Josh Peek] - * Fixtures: correctly delete and insert fixtures in a single transaction. #8553 [Michael Schuerig] * Fixtures: people(:technomancy, :josh) returns both fixtures. #7880 [technomancy, Josh Peek] diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 80f9e52f80..b6c3949a5a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -351,8 +351,7 @@ module ActiveRecord # There's a short-hand method for each of the type values declared at the top. And then there's # TableDefinition#timestamps that'll add created_at and updated_at as datetimes. def column(name, type, options = {}) - raise "You already defined column '#{name}'." if self[name] - column = ColumnDefinition.new(@base, name, type) + column = self[name] || ColumnDefinition.new(@base, name, type) column.limit = options[:limit] || native[type.to_sym][:limit] if options[:limit] or native[type.to_sym] column.precision = options[:precision] column.scale = options[:scale] diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index fa765a7017..d1e2059c9a 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -807,22 +807,6 @@ 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 |