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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9e6fc8b5
Commit
9e6fc8b5
authored
Jan 23, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report failure of DB backup commands
parent
68590fdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
lib/backup/database.rb
lib/backup/database.rb
+16
-2
No files found.
lib/backup/database.rb
View file @
9e6fc8b5
...
...
@@ -11,23 +11,29 @@ module Backup
end
def
dump
case
config
[
"adapter"
]
success
=
case
config
[
"adapter"
]
when
/^mysql/
then
print
"Dumping MySQL database
#{
config
[
'database'
]
}
... "
system
(
'mysqldump'
,
*
mysql_args
,
config
[
'database'
],
out:
db_file_name
)
when
"postgresql"
then
print
"Dumping PostgreSQL database
#{
config
[
'database'
]
}
... "
pg_env
system
(
'pg_dump'
,
config
[
'database'
],
out:
db_file_name
)
end
report_success
(
success
)
end
def
restore
case
config
[
"adapter"
]
success
=
case
config
[
"adapter"
]
when
/^mysql/
then
print
"Restoring MySQL database
#{
config
[
'database'
]
}
... "
system
(
'mysql'
,
*
mysql_args
,
config
[
'database'
],
in:
db_file_name
)
when
"postgresql"
then
print
"Restoring PostgreSQL database
#{
config
[
'database'
]
}
... "
pg_env
system
(
'psql'
,
config
[
'database'
],
'-f'
,
db_file_name
)
end
report_success
(
success
)
end
protected
...
...
@@ -54,5 +60,13 @@ module Backup
ENV
[
'PGPORT'
]
=
config
[
"port"
].
to_s
if
config
[
"port"
]
ENV
[
'PGPASSWORD'
]
=
config
[
"password"
].
to_s
if
config
[
"password"
]
end
def
report_success
(
success
)
if
success
puts
'[DONE]'
.
green
else
puts
'[FAILED]'
.
red
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