diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-21 13:23:29 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-21 13:23:29 +0300 |
commit | 9ab3e6093cef715533676f50c30880ff03716fee (patch) | |
tree | d4fe88cfc66328786ede5f5ab2d570b49f06959a /db | |
parent | 8c2192943a5efc4d0a28c67b04bf9b979def66a1 (diff) | |
download | gitlab-ce-9ab3e6093cef715533676f50c30880ff03716fee.tar.gz |
Add mysql_compatible_index_length to migration helpersdz-migration-index-helper
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db')
4 files changed, 13 insertions, 7 deletions
diff --git a/db/migrate/20170222111732_create_gpg_keys.rb b/db/migrate/20170222111732_create_gpg_keys.rb index 541228e8735..0d6d454bbf3 100644 --- a/db/migrate/20170222111732_create_gpg_keys.rb +++ b/db/migrate/20170222111732_create_gpg_keys.rb @@ -1,4 +1,6 @@ class CreateGpgKeys < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + DOWNTIME = false def change @@ -12,8 +14,8 @@ class CreateGpgKeys < ActiveRecord::Migration t.text :key - t.index :primary_keyid, unique: true, length: Gitlab::Database.mysql? ? 20 : nil - t.index :fingerprint, unique: true, length: Gitlab::Database.mysql? ? 20 : nil + t.index :primary_keyid, unique: true, length: mysql_compatible_index_length + t.index :fingerprint, unique: true, length: mysql_compatible_index_length end end end diff --git a/db/migrate/20170613154149_create_gpg_signatures.rb b/db/migrate/20170613154149_create_gpg_signatures.rb index f6b5e7ebb7b..abef13a7a0b 100644 --- a/db/migrate/20170613154149_create_gpg_signatures.rb +++ b/db/migrate/20170613154149_create_gpg_signatures.rb @@ -1,4 +1,6 @@ class CreateGpgSignatures < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + DOWNTIME = false def change @@ -16,8 +18,8 @@ class CreateGpgSignatures < ActiveRecord::Migration t.text :gpg_key_user_name t.text :gpg_key_user_email - t.index :commit_sha, unique: true, length: Gitlab::Database.mysql? ? 20 : nil - t.index :gpg_key_primary_keyid, length: Gitlab::Database.mysql? ? 20 : nil + t.index :commit_sha, unique: true, length: mysql_compatible_index_length + t.index :gpg_key_primary_keyid, length: mysql_compatible_index_length end end end diff --git a/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb b/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb index 1b360b231a8..2140ff7b05e 100644 --- a/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb +++ b/db/migrate/20170827123848_add_index_on_merge_request_diff_commit_sha.rb @@ -8,7 +8,7 @@ class AddIndexOnMergeRequestDiffCommitSha < ActiveRecord::Migration disable_ddl_transaction! def up - add_concurrent_index :merge_request_diff_commits, :sha, length: Gitlab::Database.mysql? ? 20 : nil + add_concurrent_index :merge_request_diff_commits, :sha, length: mysql_compatible_index_length end def down diff --git a/db/migrate/20170927161718_create_gpg_key_subkeys.rb b/db/migrate/20170927161718_create_gpg_key_subkeys.rb index c03c40416a8..d9dc2404cac 100644 --- a/db/migrate/20170927161718_create_gpg_key_subkeys.rb +++ b/db/migrate/20170927161718_create_gpg_key_subkeys.rb @@ -1,4 +1,6 @@ class CreateGpgKeySubkeys < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + DOWNTIME = false def up @@ -8,8 +10,8 @@ class CreateGpgKeySubkeys < ActiveRecord::Migration t.binary :keyid t.binary :fingerprint - t.index :keyid, unique: true, length: Gitlab::Database.mysql? ? 20 : nil - t.index :fingerprint, unique: true, length: Gitlab::Database.mysql? ? 20 : nil + t.index :keyid, unique: true, length: mysql_compatible_index_length + t.index :fingerprint, unique: true, length: mysql_compatible_index_length end add_reference :gpg_signatures, :gpg_key_subkey, index: true, foreign_key: { on_delete: :nullify } |