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/lib/active_record | |
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/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 b6c3949a5a..80f9e52f80 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -351,7 +351,8 @@ 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 = {}) - column = self[name] || ColumnDefinition.new(@base, name, type) + raise "You already defined column '#{name}'." if self[name] + column = 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] |