BigW Consortium Gitlab

20131112220935_add_visibility_level_to_projects.rb 620 Bytes
Newer Older
1
class AddVisibilityLevelToProjects < ActiveRecord::Migration
2 3
  include Gitlab::Database

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

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