diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 00:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 00:08:57 +0300 |
commit | a6c2be7cd20a9515b347e72d63c5b47bb9b79457 (patch) | |
tree | 568212b4debeb2a35bb1133209b98e1468d9ee85 /lib/gitlab/database | |
parent | 74a2d57b337034cfdcd719615e4da06643b69114 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/database')
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 95a562ca1f3..f75e943671b 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -235,11 +235,17 @@ module Gitlab # PostgreSQL constraint names have a limit of 63 bytes. The logic used # here is based on Rails' foreign_key_name() method, which unfortunately # is private so we can't rely on it directly. - def concurrent_foreign_key_name(table, column) + # + # prefix: + # - The default prefix is `fk_` for backward compatibility with the existing + # concurrent foreign key helpers. + # - For standard rails foreign keys the prefix is `fk_rails_` + # + def concurrent_foreign_key_name(table, column, prefix: 'fk_') identifier = "#{table}_#{column}_fk" hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10) - "fk_#{hashed_identifier}" + "#{prefix}#{hashed_identifier}" end # Long-running migrations may take more than the timeout allowed by |