change_column "current_ways", "user_id", :bigint, :limit => 20, :null => false
change_column "current_ways", "timestamp", :datetime, :null => false
change_column "current_ways", "visible", :boolean, :null => false
- execute "ALTER TABLE current_ways ENGINE = InnoDB"
+ change_engine "current_ways", "InnoDB"
change_column "diary_entries", "title", :string, :null => false
change_column "diary_entries", "body", :text, :null => false
change_column "diary_entries", "body", :text
change_column "diary_entries", "title", :string, :default => nil
- execute "ALTER TABLE current_ways ENGINE = MyISAM"
+ change_engine "current_ways", "MyISAM"
change_column "current_ways", "visible", :boolean
change_column "current_ways", "timestamp", :datetime
change_column "current_ways", "user_id", :bigint, :limit => 20
class SqlSessionStoreSetup < ActiveRecord::Migration
def self.up
- create_table "sessions", :options => "ENGINE=InnoDB" do |t|
+ create_table "sessions", :options => innodb_option do |t|
t.column "session_id", :string
t.column "data", :text
t.column "created_at", :timestamp
def innodb_table
return { :id => false, :force => true, :options => "ENGINE=InnoDB" }
end
+
+ def innodb_option
+ return "ENGINE=InnoDB"
+ end
+
+ def change_engine (table_name, engine)
+ execute "ALTER TABLE #{table_name} ENGINE = #{engine}"
+ end
end
end
end