Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
e9657acf
Commit
e9657acf
authored
Mar 02, 2018
by
Mayra Cabrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure foreign keys on Clusters Applications
Closes #43802
parent
98c8c90e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
changelogs/unreleased/43802-ensure-foreign-keys-on-clusters-applications.yml
...ed/43802-ensure-foreign-keys-on-clusters-applications.yml
+5
-0
db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
...302152117_ensure_foreign_keys_on_clusters_applications.rb
+34
-0
db/schema.rb
db/schema.rb
+2
-0
No files found.
changelogs/unreleased/43802-ensure-foreign-keys-on-clusters-applications.yml
0 → 100644
View file @
e9657acf
---
title
:
Ensure foreign keys on clusters applications
merge_request
:
17488
author
:
type
:
other
db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
0 → 100644
View file @
e9657acf
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
EnsureForeignKeysOnClustersApplications
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
unless
foreign_keys_for
(
:clusters_applications_ingress
,
:cluster_id
).
any?
add_concurrent_foreign_key
:clusters_applications_ingress
,
:clusters
,
column: :cluster_id
,
on_delete: :cascade
end
unless
foreign_keys_for
(
:clusters_applications_prometheus
,
:cluster_id
).
any?
add_concurrent_foreign_key
:clusters_applications_prometheus
,
:clusters
,
column: :cluster_id
,
on_delete: :cascade
end
end
def
down
if
foreign_keys_for
(
:clusters_applications_ingress
,
:cluster_id
).
any?
remove_foreign_key
:clusters_applications_ingress
,
column: :cluster_id
end
if
foreign_keys_for
(
:clusters_applications_prometheus
,
:cluster_id
).
any?
remove_foreign_key
:clusters_applications_prometheus
,
column: :cluster_id
end
end
end
db/schema.rb
View file @
e9657acf
...
...
@@ -2028,6 +2028,8 @@ ActiveRecord::Schema.define(version: 20180307012445) do
add_foreign_key
"cluster_providers_gcp"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"clusters_applications_helm"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_ingress"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_prometheus"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_runners"
,
"ci_runners"
,
column:
"runner_id"
,
name:
"fk_02de2ded36"
,
on_delete: :nullify
add_foreign_key
"clusters_applications_runners"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"container_repositories"
,
"projects"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment