ActiveRecord should raise an error on invalid migration types.

This commit is contained in:
José Valim 2010-02-28 11:53:48 +01:00
parent ae8070e21b
commit f3839b2b99
2 changed files with 17 additions and 4 deletions

View File

@ -319,6 +319,8 @@ module ActiveRecord
def method_missing(symbol, *args)
if symbol.to_s == 'xml'
xml_column_fallback(args)
else
super
end
end
@ -329,6 +331,7 @@ module ActiveRecord
column(args[0], :text, options)
end
end
# Appends a primary key definition to the table definition.
# Can be called multiple times, but this is probably not a good idea.
def primary_key(name)

View File

@ -27,6 +27,16 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_nothing_raised { @connection.select_all "SELECT * FROM schema_migrations" }
assert_equal 7, ActiveRecord::Migrator::current_version
end
def test_schema_raises_an_error_for_invalid_column_ntype
assert_raise NoMethodError do
ActiveRecord::Schema.define(:version => 8) do
create_table :vegetables do |t|
t.unknown :color
end
end
end
end
end
end