Commit fc281c0a authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'jh-update_db_docs' into 'master'

Update database migration docs to avoid rubocop offense

See merge request gitlab-org/gitlab!45157
parents 1d5447b9 d18d5775
......@@ -295,13 +295,16 @@ end
Adding foreign key to `projects`:
We can use the `add_concurrenct_foreign_key` method in this case, as this helper method
has the lock retries built into it.
```ruby
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
def up
with_lock_retries do
add_foreign_key :imports, :projects, column: :project_id, on_delete: :cascade
end
add_concurrent_foreign_key :imports, :projects, column: :project_id, on_delete: :cascade
end
def down
......@@ -316,10 +319,10 @@ Adding foreign key to `users`:
```ruby
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
def up
with_lock_retries do
add_foreign_key :imports, :users, column: :user_id, on_delete: :cascade
end
add_concurrent_foreign_key :imports, :users, column: :user_id, on_delete: :cascade
end
def down
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment