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
Léo-Paul Géneau
gitlab-ce
Commits
78192747
Commit
78192747
authored
Apr 11, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-missing-mixin' into 'master'
Use false/true mixin in migration from !3640 See merge request !3646
parents
93cfc0b2
13c00262
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
db/migrate/20141007100818_add_visibility_level_to_snippet.rb
db/migrate/20141007100818_add_visibility_level_to_snippet.rb
+6
-4
No files found.
db/migrate/20141007100818_add_visibility_level_to_snippet.rb
View file @
78192747
class
AddVisibilityLevelToSnippet
<
ActiveRecord
::
Migration
class
AddVisibilityLevelToSnippet
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
def
up
def
up
add_column
:snippets
,
:visibility_level
,
:integer
,
:default
=>
0
,
:null
=>
false
add_column
:snippets
,
:visibility_level
,
:integer
,
:default
=>
0
,
:null
=>
false
execute
(
"UPDATE snippets SET visibility_level =
#{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
WHERE private =
true
"
)
execute
(
"UPDATE snippets SET visibility_level =
#{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
WHERE private =
#{
true_value
}
"
)
execute
(
"UPDATE snippets SET visibility_level =
#{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
WHERE private =
false
"
)
execute
(
"UPDATE snippets SET visibility_level =
#{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
WHERE private =
#{
false_value
}
"
)
add_index
:snippets
,
:visibility_level
add_index
:snippets
,
:visibility_level
...
@@ -13,8 +15,8 @@ class AddVisibilityLevelToSnippet < ActiveRecord::Migration
...
@@ -13,8 +15,8 @@ class AddVisibilityLevelToSnippet < ActiveRecord::Migration
def
down
def
down
add_column
:snippets
,
:private
,
:boolean
,
:default
=>
false
,
:null
=>
false
add_column
:snippets
,
:private
,
:boolean
,
:default
=>
false
,
:null
=>
false
execute
(
"UPDATE snippets SET private =
false
WHERE visibility_level =
#{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
"
)
execute
(
"UPDATE snippets SET private =
#{
false_value
}
WHERE visibility_level =
#{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
"
)
execute
(
"UPDATE snippets SET private =
true
WHERE visibility_level =
#{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
"
)
execute
(
"UPDATE snippets SET private =
#{
true_value
}
WHERE visibility_level =
#{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
"
)
remove_column
:snippets
,
:visibility_level
remove_column
:snippets
,
:visibility_level
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