debian-mirror-gitlab/db/migrate/20131112220935_add_visibility_level_to_projects.rb

17 lines
642 B
Ruby
Raw Normal View History

# rubocop:disable all
2014-09-02 18:07:02 +05:30
class AddVisibilityLevelToProjects < ActiveRecord::Migration
2016-06-02 11:05:42 +05:30
include Gitlab::Database
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