MySql 4.0.16 and Migrations


#1

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


#2

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


#3

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


#4

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


#5

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


#6

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


#7

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).