aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-12-26 10:43:19 +0900
committerGitHub <noreply@github.com>2017-12-26 10:43:19 +0900
commit87d6fb4ece170d58ad8e0a596e9fbc96a868d03b (patch)
tree59b6a193a592f230e2ab270365e7e7ff9e3d9824 /activerecord/test
parent4943c7ed11ecb9c0ae2df369faecadead08f886b (diff)
parent55eea4e42d557037600c71556700bb82fcebcb0a (diff)
downloadrails-87d6fb4ece170d58ad8e0a596e9fbc96a868d03b.tar.gz
rails-87d6fb4ece170d58ad8e0a596e9fbc96a868d03b.tar.bz2
rails-87d6fb4ece170d58ad8e0a596e9fbc96a868d03b.zip
Merge pull request #31562 from fatkodima/sqlite_migration_compatibility
Fix `add_column` with :primary_key type compatibility for SQLite
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/migration/compatibility_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb
index cc2391f349..eb6d65d1b1 100644
--- a/activerecord/test/cases/migration/compatibility_test.rb
+++ b/activerecord/test/cases/migration/compatibility_test.rb
@@ -267,6 +267,25 @@ module LegacyPrimaryKeyTestCases
end
end
+ if current_adapter?(:SQLite3Adapter)
+ def test_add_column_with_legacy_primary_key_should_work
+ @migration = Class.new(migration_class) {
+ def change
+ create_table :legacy_primary_keys, id: false do |t|
+ t.integer :dummy
+ end
+ add_column :legacy_primary_keys, :id, :primary_key
+ end
+ }.new
+
+ @migration.migrate(:up)
+
+ assert_equal "id", LegacyPrimaryKey.primary_key
+ legacy_pk = LegacyPrimaryKey.columns_hash["id"]
+ assert_not legacy_pk.null
+ end
+ end
+
def test_legacy_join_table_foreign_keys_should_be_integer
@migration = Class.new(migration_class) {
def change