Class: CortexReaver::MySQLSchema

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

Overview

Changes MySQL table engines to InnoDB

Instance Method Summary collapse

Instance Method Details

#downObject



4
5
6
# File 'lib/cortex_reaver/migrations/009_mysql.rb', line 4

def down
  # Noop
end

#upObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cortex_reaver/migrations/009_mysql.rb', line 8

def up
  db = CortexReaver.db
  begin
    if db.is_a? Sequel::MySQL::Database
      # Use InnoDB storage for everything
      db.tables.each do |table|
        db << "ALTER TABLE `#{table.to_s}` ENGINE = InnoDB;"
      end
    end
  rescue NameError
    # Not mysql!
  end
end