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.
37c332966b49eeb1d54eeefd3bc5ce97?d=identicon&s=25 David Corbin (Guest)
on 2006-02-27 01: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
6edd67c92a1dab5eb23fed79f3c18564?d=identicon&s=25 David Heinemeier Hansson (Guest)
on 2006-02-27 02: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 Hansson
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
97a7959f0d9e6c90ddae200520e93067?d=identicon&s=25 Damon Clinkscales (Guest)
on 2006-02-27 03:18
(Received via mailing list)
David Corbin <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
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-02-27 09:43
(Received via mailing list)
David Corbin 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
37c332966b49eeb1d54eeefd3bc5ce97?d=identicon&s=25 David Corbin (Guest)
on 2006-02-27 11:05
(Received via mailing list)
On Sunday 26 February 2006 08:47 pm, David Heinemeier Hansson 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
4005a47a8f2ceee49670b920593c1d52?d=identicon&s=25 Ben Munat (Guest)
on 2006-02-27 18:04
(Received via mailing list)
David Corbin 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
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-02-27 18:16
(Received via mailing list)
Ben Munat wrote:
> David Corbin 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.