2016-06-16 23:09:34 +05:30
|
|
|
# rubocop:disable all
|
2014-09-02 18:07:02 +05:30
|
|
|
class AddVisibilityLevelToProjects < ActiveRecord::Migration
|
2017-08-17 22:00:37 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def self.up
|
|
|
|
add_column :projects, :visibility_level, :integer, :default => 0, :null => false
|
2016-06-02 11:05:42 +05:30
|
|
|
execute("UPDATE projects SET visibility_level = #{Gitlab::VisibilityLevel::PUBLIC} WHERE public = #{true_value}")
|
2014-09-02 18:07:02 +05:30
|
|
|
remove_column :projects, :public
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
add_column :projects, :public, :boolean, :default => false, :null => false
|
2016-06-02 11:05:42 +05:30
|
|
|
execute("UPDATE projects SET public = #{true_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::PUBLIC}")
|
2014-09-02 18:07:02 +05:30
|
|
|
remove_column :projects, :visibility_level
|
|
|
|
end
|
|
|
|
end
|