diff options
author | travis.h.oneill@gmail.com <travis.h.oneill@gmail.com> | 2016-08-17 17:21:54 -0700 |
---|---|---|
committer | travis.h.oneill@gmail.com <travis.h.oneill@gmail.com> | 2016-08-17 17:21:54 -0700 |
commit | 906ff07e71eade42ac3856591faea5ffe857b44f (patch) | |
tree | 3b55dada9db38d9c3600aff6169536bc3596555c /activerecord/test/cases/database_statements_test.rb | |
parent | 6568cfd78c89fe70ac7304d03f8f4825fe0b7c72 (diff) | |
download | rails-906ff07e71eade42ac3856591faea5ffe857b44f.tar.gz rails-906ff07e71eade42ac3856591faea5ffe857b44f.tar.bz2 rails-906ff07e71eade42ac3856591faea5ffe857b44f.zip |
Added nil case handling to allow rollback migration in case of
invalid column type
/activerecord/lib/active_record/connection_adapters
/abstract/schema_definitions.rb:306
type = type.to_sym
Changed to the following to handle nil case:
type = type.to_sym if type
Added regression test for this case:
/activerecord/test/cases/migration_test.rb:554
if current_adapter?(:SQLite3Adapter)
def test_allows_sqlite3_rollback_on_invalid_column_type
Person.connection.create_table :something, force: true do |t|
t.column :number, :integer
t.column :name, :string
t.column :foo, :bar
end
assert Person.connection.column_exists?(:something, :foo)
assert_nothing_raised { Person.connection.remove_column :something, :foo, :bar }
assert !Person.connection.column_exists?(:something, :foo)
assert Person.connection.column_exists?(:something, :name)
assert Person.connection.column_exists?(:something, :number)
ensure
Person.connection.drop_table :something, if_exists: true
end
end
Diffstat (limited to 'activerecord/test/cases/database_statements_test.rb')
0 files changed, 0 insertions, 0 deletions