view db/migrate/20130710182539_add_queries_visibility.rb @ 1596:45b0571b684d dockerise

Minor docs, fixes, test
author Chris Cannam
date Fri, 18 Aug 2017 20:27:40 +0100
parents 261b3d9a4903
children
line wrap: on
line source
class AddQueriesVisibility < ActiveRecord::Migration
  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