2016-06-09 08:39:16 -04:00
|
|
|
# rubocop:disable all
|
2013-11-06 10:13:21 -05:00
|
|
|
class AddVisibilityLevelToProjects < ActiveRecord::Migration
|
2017-04-10 06:23:28 -04:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
2016-04-10 09:22:58 -04:00
|
|
|
|
2013-11-06 10:13:21 -05:00
|
|
|
def self.up
|
|
|
|
add_column :projects, :visibility_level, :integer, :default => 0, :null => false
|
2016-04-10 09:22:58 -04:00
|
|
|
execute("UPDATE projects SET visibility_level = #{Gitlab::VisibilityLevel::PUBLIC} WHERE public = #{true_value}")
|
2013-11-06 10:13:21 -05:00
|
|
|
remove_column :projects, :public
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
add_column :projects, :public, :boolean, :default => false, :null => false
|
2016-04-10 09:22:58 -04:00
|
|
|
execute("UPDATE projects SET public = #{true_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::PUBLIC}")
|
2013-11-06 10:13:21 -05:00
|
|
|
remove_column :projects, :visibility_level
|
|
|
|
end
|
|
|
|
end
|