Forum: Ruby on Rails How make this migration:

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ccf0f43fe1adcaf0992e9576f0eb4494?d=identicon&s=25 Marcelo Junior (Guest)
on 2007-05-15 22:04
How make this table with migraition:

   1. CREATE TABLE Protutos (
   2.    empresa_id BIGINT NOT NULL,
   4.    descricao VARCHAR (50) NOT NULL,
   5.    PRIMARY KEY(empresa_id,codigo)
   6. ) TYPE = MyISAM

Without field ID outo_increment
With type MyISAM
With two primary keys

And how work this model? How made for working with Finds?
4715ae8a9ac5152600ccd3012267ab6b?d=identicon&s=25 James Stewart (Guest)
on 2007-05-15 22:18
(Received via mailing list)
On 15 May 2007, at 16:04, Marcelo Junior wrote:
> With type MyISAM
> With two primary keys
> And how work this model? How made for working with Finds?

Most rails developers avoid composite primary keys wherever possible.
Rails is not designed to work with them, but you might like to check


James Stewart
21f7ed21f11a809050594c82eab11d67?d=identicon&s=25 Robert Walker (Guest)
on 2007-05-15 22:34
(Received via mailing list)
1.  You'll need a plugin to support composite primary keys.  Rails
won't give you that.  I would recommend designing without the need for
them.  As would most other documentation on Rails will also advise.
You life will be much more pleasant.  This is true for any object-
relational system.  Object need to have identity.  A simple integer PK
is the best way to give them that identity.

2. Rails generally uses InnoDB instead of MyISAM.  I highly
recommended this myself!

3.  BIGINT is not a supported type for standard migration code.  Look
into using "execute" within your migration to define your table when
using database specific schemas.  The "common" Rails migration code is
designed to be database agnostic so it support the most common
features that are available to all supported databases.

On May 15, 4:04 pm, Marcelo Junior <>
This topic is locked and can not be replied to.