mirror of https://github.com/rails/rails
Add test coverage for bulk altering timestamps
This commit is contained in:
parent
4913525180
commit
217f0e81d1
|
@ -1177,6 +1177,42 @@ if ActiveRecord::Base.connection.supports_bulk_alter?
|
|||
assert column(:qualification_experience)
|
||||
end
|
||||
|
||||
def test_adding_timestamps
|
||||
with_bulk_change_table do |t|
|
||||
t.string :title
|
||||
end
|
||||
|
||||
assert column(:title)
|
||||
|
||||
assert_queries(1) do
|
||||
with_bulk_change_table do |t|
|
||||
t.timestamps
|
||||
t.remove :title
|
||||
end
|
||||
end
|
||||
|
||||
[:created_at, :updated_at].each { |c| assert column(c) }
|
||||
assert_not column(:title)
|
||||
end
|
||||
|
||||
def test_removing_timestamps
|
||||
with_bulk_change_table do |t|
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
[:created_at, :updated_at].each { |c| assert column(c) }
|
||||
|
||||
assert_queries(1) do
|
||||
with_bulk_change_table do |t|
|
||||
t.remove_timestamps
|
||||
t.string :title
|
||||
end
|
||||
end
|
||||
|
||||
[:created_at, :updated_at].each { |c| assert_not column(c) }
|
||||
assert column(:title)
|
||||
end
|
||||
|
||||
def test_adding_indexes
|
||||
with_bulk_change_table do |t|
|
||||
t.string :username
|
||||
|
|
Loading…
Reference in New Issue