提交 d9230792 编写于 作者: K Koichi ITO

Add test for backward compatibility when using change_table

上级 db7398f7
......@@ -90,6 +90,21 @@ def migrate(x)
connection.drop_table :more_testings rescue nil
end
def test_timestamps_have_null_constraints_if_not_present_in_migration_of_change_table
migration = Class.new(ActiveRecord::Migration[4.2]) {
def migrate(x)
change_table :testings do |t|
t.timestamps
end
end
}.new
ActiveRecord::Migrator.new(:up, [migration]).migrate
assert connection.columns(:testings).find { |c| c.name == "created_at" }.null
assert connection.columns(:testings).find { |c| c.name == "updated_at" }.null
end
def test_timestamps_have_null_constraints_if_not_present_in_migration_for_adding_timestamps_to_existing_table
migration = Class.new(ActiveRecord::Migration[4.2]) {
def migrate(x)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册