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
iv
gitlab-ce
Commits
d58eb62d
Commit
d58eb62d
authored
Feb 19, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrations iproved
parent
e5f048f4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
34 deletions
+11
-34
db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
...igrate/20130218141258_convert_closed_to_state_in_issue.rb
+3
-8
db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb
...0130218141327_convert_closed_to_state_in_merge_request.rb
+5
-18
db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb
...te/20130218141344_convert_closed_to_state_in_milestone.rb
+3
-8
No files found.
db/migrate/20130218141258_convert_closed_to_state_in_issue.rb
View file @
d58eb62d
class
ConvertClosedToStateInIssue
<
ActiveRecord
::
Migration
class
ConvertClosedToStateInIssue
<
ActiveRecord
::
Migration
def
up
def
up
Issue
.
transaction
do
Issue
.
transaction
do
Issue
.
find_each
do
|
issue
|
Issue
.
where
(
closed:
true
).
update_all
(
"state = 'closed'"
)
issue
.
state
=
issue
.
closed?
?
:closed
:
:opened
Issue
.
where
(
closed:
false
).
update_all
(
"state = 'opened'"
)
issue
.
save
end
end
end
end
end
def
down
def
down
Issue
.
transaction
do
Issue
.
transaction
do
Issue
.
find_each
do
|
issue
|
Issue
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
issue
.
closed
=
issue
.
closed?
issue
.
save
end
end
end
end
end
end
end
db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb
View file @
d58eb62d
class
ConvertClosedToStateInMergeRequest
<
ActiveRecord
::
Migration
class
ConvertClosedToStateInMergeRequest
<
ActiveRecord
::
Migration
def
up
def
up
MergeRequest
.
transaction
do
MergeRequest
.
transaction
do
MergeRequest
.
find_each
do
|
mr
|
MergeRequest
.
where
(
"closed = 1 AND merged = 1"
).
update_all
(
"state = 'merged'"
)
if
mr
.
closed?
&&
mr
.
merged?
MergeRequest
.
where
(
"closed = 1 AND merged = 0"
).
update_all
(
"state = 'closed'"
)
mr
.
state
=
:merged
MergeRequest
.
where
(
"closed = 0"
).
update_all
(
"state = 'opened'"
)
else
if
mr
.
closed?
mr
.
state
=
:closed
else
mr
.
state
=
:opened
end
end
mr
.
save
end
end
end
end
end
def
down
def
down
MergeRequest
.
transaction
do
MergeRequest
.
transaction
do
MergeRequest
.
find_each
do
|
mr
|
MergeRequest
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
mr
.
closed
=
mr
.
closed?
||
mr
.
merged?
MergeRequest
.
where
(
state: :merged
).
update_all
(
"closed = 1, merged = 1"
)
mr
.
closed
=
mr
.
merged?
mr
.
save
end
end
end
end
end
end
end
db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb
View file @
d58eb62d
class
ConvertClosedToStateInMilestone
<
ActiveRecord
::
Migration
class
ConvertClosedToStateInMilestone
<
ActiveRecord
::
Migration
def
up
def
up
Milestone
.
transaction
do
Milestone
.
transaction
do
Milestone
.
find_each
do
|
milestone
|
Milestone
.
where
(
closed:
false
).
update_all
(
"state = 'opened'"
)
milestone
.
state
=
milestone
.
closed?
?
:closed
:
:active
Milestone
.
where
(
closed:
false
).
update_all
(
"state = 'active'"
)
milestone
.
save
end
end
end
end
end
def
down
def
down
Milestone
.
transaction
do
Milestone
.
transaction
do
Milestone
.
find_each
do
|
milestone
|
Milestone
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
milestone
.
closed
=
milestone
.
closed?
milestone
.
save
end
end
end
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