aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-11-15 08:16:27 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-11-15 08:16:27 +0900
commit6a34ef52c9eda2bc9ef85325bfa0a43cb4afd724 (patch)
tree252456c3ab8603cca3a886d77de46667dde3eaee /activerecord
parentca68f1cf49a3689c276d502105aaa68fa106502d (diff)
downloadrails-6a34ef52c9eda2bc9ef85325bfa0a43cb4afd724.tar.gz
rails-6a34ef52c9eda2bc9ef85325bfa0a43cb4afd724.tar.bz2
rails-6a34ef52c9eda2bc9ef85325bfa0a43cb4afd724.zip
Fix CI failure due to invalid `up_only` for MySQL
`oldie = 'true'` to `tinyint(1)` column is invalid value for MySQL: ``` Mysql2::Error: Incorrect integer value: 'true' for column 'oldie' at row 1: update horses set oldie = 'true' ```
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/invertible_migration_test.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/test/cases/invertible_migration_test.rb b/activerecord/test/cases/invertible_migration_test.rb
index e0f40710eb..ebe0b0aa87 100644
--- a/activerecord/test/cases/invertible_migration_test.rb
+++ b/activerecord/test/cases/invertible_migration_test.rb
@@ -163,11 +163,13 @@ module ActiveRecord
class UpOnlyMigration < SilentMigration
def change
- add_column :horses, :oldie, :boolean, default: false
- up_only { execute "update horses set oldie = 'true'" }
+ add_column :horses, :oldie, :integer, default: 0
+ up_only { execute "update horses set oldie = 1" }
end
end
+ self.use_transactional_tests = false
+
setup do
@verbose_was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, false
end
@@ -389,14 +391,14 @@ module ActiveRecord
def test_up_only
InvertibleMigration.new.migrate(:up)
horse1 = Horse.create
- # populates existing horses with oldie=true but new ones have default false
+ # populates existing horses with oldie = 1 but new ones have default 0
UpOnlyMigration.new.migrate(:up)
Horse.reset_column_information
horse1.reload
horse2 = Horse.create
- assert horse1.oldie? # created before migration
- assert !horse2.oldie? # created after migration
+ assert 1, horse1.oldie # created before migration
+ assert 0, horse2.oldie # created after migration
UpOnlyMigration.new.migrate(:down) # should be no error
connection = ActiveRecord::Base.connection