From 9b444fe73beaddccd5664d0e0f17f948f00680bf Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 8 Jun 2007 01:40:05 +0000 Subject: Rollback [6961] which breaks SQLite tests. Reference #7345. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6965 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 -- .../connection_adapters/abstract/schema_definitions.rb | 3 +-- activerecord/test/migration_test.rb | 16 ---------------- 3 files changed, 1 insertion(+), 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 -- cgit v1.2.3