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
Léo-Paul Géneau
gitlab-ce
Commits
8a7cd25d
Commit
8a7cd25d
authored
Mar 01, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For MySQL, foreign keys are dependent on index.
parent
43b74afd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
db/migrate/20180223120443_create_user_interacted_projects_table.rb
...e/20180223120443_create_user_interacted_projects_table.rb
+0
-3
db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
...te/20180223124427_build_user_interacted_projects_table.rb
+6
-0
No files found.
db/migrate/20180223120443_create_user_interacted_projects_table.rb
View file @
8a7cd25d
...
...
@@ -10,9 +10,6 @@ class CreateUserInteractedProjectsTable < ActiveRecord::Migration
t
.
references
:user
,
null:
false
t
.
references
:project
,
null:
false
end
add_concurrent_foreign_key
:user_interacted_projects
,
:users
,
column: :user_id
,
on_delete: :cascade
add_concurrent_foreign_key
:user_interacted_projects
,
:projects
,
column: :project_id
,
on_delete: :cascade
end
def
down
...
...
db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
View file @
8a7cd25d
...
...
@@ -14,11 +14,17 @@ class BuildUserInteractedProjectsTable < ActiveRecord::Migration
end
.
up
add_concurrent_index
:user_interacted_projects
,
[
:project_id
,
:user_id
],
unique:
true
add_concurrent_foreign_key
:user_interacted_projects
,
:users
,
column: :user_id
,
on_delete: :cascade
add_concurrent_foreign_key
:user_interacted_projects
,
:projects
,
column: :project_id
,
on_delete: :cascade
end
def
down
execute
"TRUNCATE user_interacted_projects"
remove_foreign_key
:user_interacted_projects
,
:users
remove_foreign_key
:user_interacted_projects
,
:projects
remove_concurrent_index_by_name
:user_interacted_projects
,
'index_user_interacted_projects_on_project_id_and_user_id'
end
...
...
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