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
Jérome Perrin
gitlab-ce
Commits
929c20c2
Commit
929c20c2
authored
Jan 24, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the time estimate migrations reversible
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
c66c3a46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
+11
-1
db/migrate/20161223034646_create_timelogs_ce.rb
db/migrate/20161223034646_create_timelogs_ce.rb
+5
-1
No files found.
db/migrate/20161223034433_add_estimate_to_issuables_ce.rb
View file @
929c20c2
...
@@ -3,7 +3,7 @@ class AddEstimateToIssuablesCe < ActiveRecord::Migration
...
@@ -3,7 +3,7 @@ class AddEstimateToIssuablesCe < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
def
change
def
up
unless
column_exists?
(
:issues
,
:time_estimate
)
unless
column_exists?
(
:issues
,
:time_estimate
)
add_column
:issues
,
:time_estimate
,
:integer
add_column
:issues
,
:time_estimate
,
:integer
end
end
...
@@ -12,4 +12,14 @@ class AddEstimateToIssuablesCe < ActiveRecord::Migration
...
@@ -12,4 +12,14 @@ class AddEstimateToIssuablesCe < ActiveRecord::Migration
add_column
:merge_requests
,
:time_estimate
,
:integer
add_column
:merge_requests
,
:time_estimate
,
:integer
end
end
end
end
def
down
if
column_exists?
(
:issues
,
:time_estimate
)
remove_column
:issues
,
:time_estimate
end
if
column_exists?
(
:merge_requests
,
:time_estimate
)
remove_column
:merge_requests
,
:time_estimate
end
end
end
end
db/migrate/20161223034646_create_timelogs_ce.rb
View file @
929c20c2
...
@@ -3,7 +3,7 @@ class CreateTimelogsCe < ActiveRecord::Migration
...
@@ -3,7 +3,7 @@ class CreateTimelogsCe < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
def
change
def
up
unless
table_exists?
(
:timelogs
)
unless
table_exists?
(
:timelogs
)
create_table
:timelogs
do
|
t
|
create_table
:timelogs
do
|
t
|
t
.
integer
:time_spent
,
null:
false
t
.
integer
:time_spent
,
null:
false
...
@@ -17,4 +17,8 @@ class CreateTimelogsCe < ActiveRecord::Migration
...
@@ -17,4 +17,8 @@ class CreateTimelogsCe < ActiveRecord::Migration
add_index
:timelogs
,
:user_id
add_index
:timelogs
,
:user_id
end
end
end
end
def
down
drop_table
:timelogs
if
table_exists?
(
:timelogs
)
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