How make this migration:

How make this table with migraition:

  1. CREATE TABLE Protutos (
  2. empresa_id BIGINT NOT NULL,
  3. codigo BIGINT NOT NULL AUTO_INCREMENT,
  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?

On 15 May 2007, at 16:04, Marcelo J. 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
out:

http://compositekeys.rubyforge.org/

James.


James S.
http://jystewart.net/process/

  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 J. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs