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
Jérome Perrin
gitlab-ce
Commits
cfd103db
Commit
cfd103db
authored
Jul 25, 2016
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable MySQL foreign key checks before dropping all tables
parent
9fead2b8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
CHANGELOG
CHANGELOG
+1
-0
lib/tasks/gitlab/db.rake
lib/tasks/gitlab/db.rake
+7
-0
No files found.
CHANGELOG
View file @
cfd103db
...
...
@@ -14,6 +14,7 @@ v 8.11.0 (unreleased)
v 8.10.2 (unreleased)
- User can now search branches by name. !5144
- Fix backup restore. !5459
- Disable MySQL foreign key checks before dropping all tables. !5472
- Use project ID in repository cache to prevent stale data from persisting across projects. !5460
v 8.10.1
...
...
lib/tasks/gitlab/db.rake
View file @
cfd103db
...
...
@@ -25,6 +25,10 @@ namespace :gitlab do
desc
'Drop all tables'
task
:drop_tables
=>
:environment
do
connection
=
ActiveRecord
::
Base
.
connection
# If MySQL, turn off foreign key checks
connection
.
execute
(
'SET FOREIGN_KEY_CHECKS=0'
)
if
Gitlab
::
Database
.
mysql?
tables
=
connection
.
tables
tables
.
delete
'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run
...
...
@@ -35,6 +39,9 @@ namespace :gitlab do
# MySQL: http://dev.mysql.com/doc/refman/5.7/en/drop-table.html
# Add `IF EXISTS` because cascade could have already deleted a table.
tables
.
each
{
|
t
|
connection
.
execute
(
"DROP TABLE IF EXISTS
#{
connection
.
quote_table_name
(
t
)
}
CASCADE"
)
}
# If MySQL, re-enable foreign key checks
connection
.
execute
(
'SET FOREIGN_KEY_CHECKS=1'
)
if
Gitlab
::
Database
.
mysql?
end
desc
'Configures the database by running migrate, or by loading the schema and seeding if needed'
...
...
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