Class: CortexReaver::DropCommentTitlesSchema

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/cortex_reaver/migrations/016_drop_comment_titles.rb

Instance Method Summary collapse

Instance Method Details

#downObject



3
4
5
# File 'lib/cortex_reaver/migrations/016_drop_comment_titles.rb', line 3

def down
  alter_table(:comments) { add_column :varchar, :title }
end

#upObject



7
8
9
10
11
12
13
14
# File 'lib/cortex_reaver/migrations/016_drop_comment_titles.rb', line 7

def up
  if CortexReaver.db[:comments].filter(:title => nil).invert.count > 0
    puts "About to drop titles on comments. Hit enter to confirm, ctrl-c to cancel."
    gets
  end
            
  alter_table(:comments) { drop_column :title }
end