diff options
author | pjaspers <piet@happycamper.be> | 2019-06-19 12:36:32 +0200 |
---|---|---|
committer | pjaspers <piet@happycamper.be> | 2019-06-19 12:36:32 +0200 |
commit | 31438ddd8bdb924a9f7c986d779d325f9b4dc5cd (patch) | |
tree | 6f02c53abb0e88b57ebe5e4ca95762a2ddb9c753 | |
parent | 8716eb0cef94dbbaab5821aa693a9d92fa9f37e8 (diff) | |
download | gitlab-ce-31438ddd8bdb924a9f7c986d779d325f9b4dc5cd.tar.gz |
Fix syntax coloring on emacs
The rather cryptic:
"fk_#{Digest::SHA256.hexdigest("#{table}_#{column}_fk").first(10)}"
Was too much for emacs too handle*, since it was coming from the Rails
codebase I took their way of doing the same thing and applied it here.
I think it's easier to read and it also makes emacs render the
migration helpers pretty again.
* not true, emacs can handle anything, leave emacs alone!
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 1b5cd0fbb07..2ed5074fbaa 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -225,7 +225,10 @@ module Gitlab # 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) - "fk_#{Digest::SHA256.hexdigest("#{table}_#{column}_fk").first(10)}" + identifier = "#{table_name}_#{column}_fk" + hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10) + + "fk_#{hashed_identifier}" end # Long-running migrations may take more than the timeout allowed by |