MySql 4.0.16 and Migrations

It appears that you cannot use migrations (out of the box) with mysql
4.0.16,
because when creating a table, the statement says “ENGINE=InnoDb”,
instead of
“TYPE=InnoDB”.

Looking at the source code for the adapter, this appears to be hard
coded. Is
there any supported way to make this work with older versions of MySQL?

David

It appears that you cannot use migrations (out of the box) with mysql 4.0.16,
because when creating a table, the statement says “ENGINE=InnoDb”, instead of
“TYPE=InnoDB”.

May have been different in the past, but on Edge Rails we say
“InnoDB”. So that should be fixed by the forthcoming Rails 1.1
release.

David Heinemeier H.
http://www.loudthinking.com – Broadcasting Brain
http://www.basecamphq.com – Online project management
http://www.backpackit.com – Personal information manager
http://www.rubyonrails.com – Web-application framework

David C. <dcorbin@…> writes:

It appears that you cannot use migrations (out of the box) with mysql 4.0.16,
because when creating a table, the statement says “ENGINE=InnoDb”, instead of
“TYPE=InnoDB”.

Looking at the source code for the adapter, this appears to be hard coded. Is
there any supported way to make this work with older versions of MySQL?

David,

Try this:

create_table(:mytable, :options => ‘TYPE=InnoDB’) do |t|
t.column :name, :string, :limit => 50
end

One warning, however…The schema dumper may not honor this option when
it dumps
your table back out into schema.rb.

This doesn’t prevent you from using migrations, but you just need to be
mindful.

-damon

David C. wrote:

It appears that you cannot use migrations (out of the box) with mysql 4.0.16,
because when creating a table, the statement says “ENGINE=InnoDb”, instead of
“TYPE=InnoDB”.

Looking at the source code for the adapter, this appears to be hard coded. Is
there any supported way to make this work with older versions of MySQL?

I’ve got a standard file I include for this… Stick this in lib/, and
include it from environment.rb:

module ActiveRecord
module ConnectionAdapters
class MysqlAdapter
def create_table(name, options = {})
super(name, {:options => “TYPE=InnoDB”}.merge(options))
end
end
end
end

On Sunday 26 February 2006 08:47 pm, David Heinemeier H. wrote:

It appears that you cannot use migrations (out of the box) with mysql
4.0.16, because when creating a table, the statement says
“ENGINE=InnoDb”, instead of “TYPE=InnoDB”.

May have been different in the past, but on Edge Rails we say
“InnoDB”. So that should be fixed by the forthcoming Rails 1.1
release.

The problem is the use of ENGINE, instead of TYPE.

David

David C. wrote:

The problem is the use of ENGINE, instead of TYPE.
Are you sure? I went and looked at the create table syntax in the mysql
manuals for 5.0
and for “3.23, 4.0, 4.1”. In both it says “{ENGINE|TYPE} = engine_name”.

http://dev.mysql.com/doc/refman/4.1/en/create-table.html

http://dev.mysql.com/doc/refman/5.0/en/create-table.html

b

Ben M. wrote:

David C. wrote:

The problem is the use of ENGINE, instead of TYPE.

Are you sure? I went and looked at the create table syntax in the mysql
manuals for 5.0 and for “3.23, 4.0, 4.1”. In both it says “{ENGINE|TYPE}
= engine_name”.
It’s definitely a problem in 4.0, and definitely not in 4.1. The MySQL
manual has a really nasty habit of covering up 4.0’s differences (and
deficiencies).