Informatika Mihelac
January 31 2007 migrations | mysql | rails

Help! Rails test cases do not remove fixture data

Check if target database table is of MyIsam type. You have two options, first is not to use transactional fixtures in tests:
self.use_transactional_fixtures = false

Second and better option is to convert all tables to InnoDB tables. This migration can help converting:

class MyIsam2InnoDb < ActiveRecord::Migration
  def self.up
    ActiveRecord::Base.connection.tables.each {|t| 
        execute "ALTER TABLE #{t} TYPE=InnoDB"}
  end

  def self.down
  end
end

Speak your mind:

(Required)

(Required)


(You may use textile in your comments.)

About

I am Bojan Mihelac and this blog is dedicated to share code, thoughts, tools and advices I came up with while working in Informatika Mihelac.

Contact: bmihelac@mihelac.org

RSS feedSubscribe to RSS Feed