diff options
author | Stan Hu <stanhu@gmail.com> | 2016-04-10 21:19:09 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-04-10 22:04:24 -0700 |
commit | 13c00262f74d463e6adbc008aac00a4c63faac11 (patch) | |
tree | f1f378e0bb82c3a45ed23f1bdf4925a625b67b8e /db | |
parent | 93cfc0b25eca08ad5215d48bf14095e378bb54a4 (diff) | |
download | gitlab-ce-13c00262f74d463e6adbc008aac00a4c63faac11.tar.gz |
Use false/true mixin in migration from !3640
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20141007100818_add_visibility_level_to_snippet.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb index bb3501f41db..93826185e8b 100644 --- a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb +++ b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb @@ -1,9 +1,11 @@ class AddVisibilityLevelToSnippet < ActiveRecord::Migration + include Gitlab::Database + def up 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::INTERNAL} WHERE private = false") + 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_value}") add_index :snippets, :visibility_level @@ -13,8 +15,8 @@ class AddVisibilityLevelToSnippet < ActiveRecord::Migration def down 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 = true WHERE visibility_level = #{Gitlab::VisibilityLevel::PRIVATE}") + execute("UPDATE snippets SET private = #{false_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::INTERNAL}") + execute("UPDATE snippets SET private = #{true_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::PRIVATE}") remove_column :snippets, :visibility_level end |