20131112220935_add_visibility_level_to_projects.rb 660 字节
Newer Older
S
Sean McGivern 已提交
1
# rubocop:disable all
2
class AddVisibilityLevelToProjects < ActiveRecord::Migration
3
  include Gitlab::Database::MigrationHelpers
4

5 6
  def self.up
    add_column :projects, :visibility_level, :integer, :default => 0, :null => false
7
    execute("UPDATE projects SET visibility_level = #{Gitlab::VisibilityLevel::PUBLIC} WHERE public = #{true_value}")
8 9 10 11 12
    remove_column :projects, :public
  end

  def self.down
    add_column :projects, :public, :boolean, :default => false, :null => false
13
    execute("UPDATE projects SET public = #{true_value} WHERE visibility_level = #{Gitlab::VisibilityLevel::PUBLIC}")
14 15 16
    remove_column :projects, :visibility_level
  end
end