BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e00e67db
Commit
e00e67db
authored
Oct 28, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop all Postgres sequences during backup restore
parent
01441f54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
database.rb
lib/backup/database.rb
+1
-0
drop_all_postgres_sequences.rake
lib/tasks/gitlab/db/drop_all_postgres_sequences.rake
+10
-0
No files found.
lib/backup/database.rb
View file @
e00e67db
...
...
@@ -34,6 +34,7 @@ module Backup
# Drop all tables because PostgreSQL DB dumps do not contain DROP TABLE
# statements like MySQL.
Rake
::
Task
[
"gitlab:db:drop_all_tables"
].
invoke
Rake
::
Task
[
"gitlab:db:drop_all_postgres_sequences"
].
invoke
pg_env
system
(
'psql'
,
config
[
'database'
],
'-f'
,
db_file_name
)
end
...
...
lib/tasks/gitlab/db/drop_all_postgres_sequences.rake
0 → 100644
View file @
e00e67db
namespace
:gitlab
do
namespace
:db
do
task
drop_all_postgres_sequences: :environment
do
connection
=
ActiveRecord
::
Base
.
connection
connection
.
execute
(
"SELECT c.relname FROM pg_class c WHERE c.relkind = 'S';"
).
each
do
|
sequence
|
connection
.
execute
(
"DROP SEQUENCE
#{
sequence
[
'relname'
]
}
"
)
end
end
end
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