blob: 36f298d11f790d04194bcd436f0407b213e1bac5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
class AddQueriesVisibility < ActiveRecord::Migration[4.2]
def up
add_column :queries, :visibility, :integer, :default => 0
Query.where(:is_public => true).update_all(:visibility => 2)
remove_column :queries, :is_public
end
def down
add_column :queries, :is_public, :boolean, :default => true, :null => false
Query.where('visibility <> ?', 2).update_all(:is_public => false)
remove_column :queries, :visibility
end
end
|