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
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
Hide 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
def
up
Issue
.
transaction
do
Issue
.
find_each
do
|
issue
|
issue
.
state
=
issue
.
closed?
?
:closed
:
:opened
issue
.
save
end
Issue
.
where
(
closed:
true
).
update_all
(
"state = 'closed'"
)
Issue
.
where
(
closed:
false
).
update_all
(
"state = 'opened'"
)
end
end
def
down
Issue
.
transaction
do
Issue
.
find_each
do
|
issue
|
issue
.
closed
=
issue
.
closed?
issue
.
save
end
Issue
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
end
end
end
db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb
View file @
d58eb62d
class
ConvertClosedToStateInMergeRequest
<
ActiveRecord
::
Migration
def
up
MergeRequest
.
transaction
do
MergeRequest
.
find_each
do
|
mr
|
if
mr
.
closed?
&&
mr
.
merged?
mr
.
state
=
:merged
else
if
mr
.
closed?
mr
.
state
=
:closed
else
mr
.
state
=
:opened
end
end
mr
.
save
end
MergeRequest
.
where
(
"closed = 1 AND merged = 1"
).
update_all
(
"state = 'merged'"
)
MergeRequest
.
where
(
"closed = 1 AND merged = 0"
).
update_all
(
"state = 'closed'"
)
MergeRequest
.
where
(
"closed = 0"
).
update_all
(
"state = 'opened'"
)
end
end
def
down
MergeRequest
.
transaction
do
MergeRequest
.
find_each
do
|
mr
|
mr
.
closed
=
mr
.
closed?
||
mr
.
merged?
mr
.
closed
=
mr
.
merged?
mr
.
save
end
MergeRequest
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
MergeRequest
.
where
(
state: :merged
).
update_all
(
"closed = 1, merged = 1"
)
end
end
end
db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb
View file @
d58eb62d
class
ConvertClosedToStateInMilestone
<
ActiveRecord
::
Migration
def
up
Milestone
.
transaction
do
Milestone
.
find_each
do
|
milestone
|
milestone
.
state
=
milestone
.
closed?
?
:closed
:
:active
milestone
.
save
end
Milestone
.
where
(
closed:
false
).
update_all
(
"state = 'opened'"
)
Milestone
.
where
(
closed:
false
).
update_all
(
"state = 'active'"
)
end
end
def
down
Milestone
.
transaction
do
Milestone
.
find_each
do
|
milestone
|
milestone
.
closed
=
milestone
.
closed?
milestone
.
save
end
Milestone
.
where
(
state: :closed
).
update_all
(
"closed = 1"
)
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