Forum: Ruby on Rails MySql 4.0.16 and Migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David C. (Guest)
on 2006-02-27 02:32
(Received via mailing list)
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
David Heinemeier H. (Guest)
on 2006-02-27 03:51
(Received via mailing list)
> 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
Damon C. (Guest)
on 2006-02-27 04:18
(Received via mailing list)
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
Alex Y. (Guest)
on 2006-02-27 10:43
(Received via mailing list)
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
David C. (Guest)
on 2006-02-27 12:05
(Received via mailing list)
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
Ben M. (Guest)
on 2006-02-27 19:04
(Received via mailing list)
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
Alex Y. (Guest)
on 2006-02-27 19:16
(Received via mailing list)
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).
This topic is locked and can not be replied to.