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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
d1d13856
Commit
d1d13856
authored
Jan 24, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'report_backup_db_success' into 'master'
Report success/failure of DB backup commands
parents
9bb92674
9e6fc8b5
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 @
d1d13856
...
...
@@ -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