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
3df5253c
Commit
3df5253c
authored
Mar 14, 2013
by
Chris Lawlor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds DB-sensitive tablename escape for backup task.
Uses ActiveRecord::Base.connection.quote_table_name. Fixes issue 2437.
parent
d2b882fa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
backup.rake
lib/tasks/gitlab/backup.rake
+2
-1
No files found.
lib/tasks/gitlab/backup.rake
View file @
3df5253c
...
...
@@ -178,8 +178,9 @@ namespace :gitlab do
ActiveRecord
::
Base
.
connection
.
tables
.
each
do
|
tbl
|
print
" *
#{
tbl
.
yellow
}
... "
count
=
1
safe_tablename
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
tbl
)
File
.
open
(
File
.
join
(
backup_path_db
,
tbl
+
".yml"
),
"w+"
)
do
|
file
|
ActiveRecord
::
Base
.
connection
.
select_all
(
"SELECT * FROM
`
#{
tbl
}
`
"
).
each
do
|
line
|
ActiveRecord
::
Base
.
connection
.
select_all
(
"SELECT * FROM
#{
safe_tablename
}
"
).
each
do
|
line
|
line
.
delete_if
{
|
k
,
v
|
v
.
blank?
}
output
=
{
tbl
+
'_'
+
count
.
to_s
=>
line
}
file
<<
output
.
to_yaml
.
gsub
(
/^---\n/
,
''
)
+
"
\n
"
...
...
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