# Migration doesn't seem to preserve create\_table options in s

**URL:** <https://www.ruby-forum.com/t/migration-doesnt-seem-to-preserve-create-table-options-in-s/51849>\
**Category:** Rails\
**Created:** [January 8, 2006, 7:14am UTC](https://www.ruby-forum.com/t/migration-doesnt-seem-to-preserve-create-table-options-in-s/51849 "2006-01-08T07:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariano\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@Mariano\_K](https://www.ruby-forum.com/u/Mariano_K)\
**Post date:** [January 8, 2006, 7:14am UTC](https://www.ruby-forum.com/t/migration-doesnt-seem-to-preserve-create-table-options-in-s/51849/1 "2006-01-08T07:14:07Z")

</div>

Hi,

I have the following migration (abbreviated):

class Initial \< ActiveRecord::Migration

def self.up  
create\_table :messages, :options =\> ‘ENGINE=MyISAM’, :force =\> true  
do  
|t|  
t.column :id, :integer, :null =\> false  
t.column :external\_id, :string, :null =\> false  
t.column :recipients\_count, :integer, :default =\> 0  
end  
end

def self.down  
drop\_table :messages  
end  
end

When running migrate it creates the table and the schema, but it doesn’t  
preserve the “:options” in the test environment…  
ActiveRecord::Schema.define(:version =\> 1) do

create\_table “messages”, :force =\> true do |t|  
t.column “external\_id”, :string, :default =\> “”, :null =\> false  
t.column “from”, :string, :default =\> “”, :null =\> false  
t.column “subject”, :string  
end

end

The funny thing is that this happens with the test database, not with  
development. In development these options are used to create the  
database:

mysql\> show create table messages;  
…  
messages | CREATE TABLE `messages` (  
`id` int(11) NOT NULL auto\_increment,  
`external_id` varchar(255) NOT NULL,  
`from` varchar(255) NOT NULL,  
`subject` varchar(255) default NULL,  
`body` tinytext,  
`created_on` datetime default NULL,  
`recipients_count` int(11) default ‘0’,  
PRIMARY KEY (`id`)  
) ENGINE=MyISAM DEFAULT CHARSET=latin1  
…

In test I still see “InnoDB”…

Deleting the schema.rb didn’t help.

environment.rb contains this:

config.active\_record.schema\_format = :ruby

test.rb doesn’t seem to contain anything that overrides that.

I am also wondering when the migration for test occurs? After rake  
migrate  
nothing seems to happen to the test database, but while running my tests  
with rake it seems to also do the migration.

Am I doing something wrong?

Cheers,  
Mariano
