You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20130710182539_add_queries_visibility.rb 451B

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