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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 15 May 2007, at 16:04, Marcelo Junior wrote:> 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?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 Stewart http://jystewart.net/process/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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? > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---