# MySql 4.0.16 and Migrations

**URL:** <https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977>\
**Category:** Rails\
**Created:** [February 27, 2006, 1:32am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977 "2006-02-27T01:32:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 1:32am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/1 "2006-02-27T01:32:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 2:51am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/2 "2006-02-27T02:51:08Z")

</div>

> 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](http://www.loudthinking.com) – Broadcasting Brain  
[http://www.basecamphq.com](http://www.basecamphq.com) – Online project management  
[http://www.backpackit.com](http://www.backpackit.com) – Personal information manager  
[http://www.rubyonrails.com](http://www.rubyonrails.com) – Web-application framework

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 3:18am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/3 "2006-02-27T03:18:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 9:43am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/4 "2006-02-27T09:43:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 11:05am UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/5 "2006-02-27T11:05:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 6:04pm UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/6 "2006-02-27T18:04:07Z")

</div>

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/4.1/en/create-table.html)

[http://dev.mysql.com/doc/refman/5.0/en/create-table.html](http://dev.mysql.com/doc/refman/5.0/en/create-table.html)

b

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [February 27, 2006, 6:16pm UTC](https://www.ruby-forum.com/t/mysql-4-0-16-and-migrations/73977/7 "2006-02-27T18:16:24Z")

</div>

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