Re: schema dump added auto increment on non auto increment table
Ooohhhh! Sorry about that. Yes, that looks sketchy.
On Mon, Sep 24, 2012 at 4:24 PM, John Moses <moses.john.r@gmail.com> wrote:
> Thanks for your response, it seems that there is some miscommunication.
>
> We both agree that FKs on a join table should not be auto incremented. I
> did not make the FKs on my join table auto increment. The file generated by
> the command `cake schema dump` that contains the create statements listed
> that they were auto incremented. You can see from my table declaration that
> they are not auto incremented.
>
> I hope that clears up any confusion.
>
> On Monday, September 24, 2012 2:12:31 PM UTC-5, cricket wrote:
>>
>> This has nothing at all to do with CakePHP. In a join table, the
>> columns are foreign keys pointing to the id of some other tables.
>> THOSE values are usually (but not always) auto_increment. There's no
>> sense in making your FKs auto_inc because they're not being generated
>> out of thin air (for the join table).
>>
>> You're also using InnoDB so you may as well explicitly define the FKs
>> and add constraints.
>>
>> On Sun, Sep 23, 2012 at 10:06 PM, John Moses <moses....@gmail.com> wrote:
>> > Hey guys,
>> > I was going to report a bug, but wanted to make sure it wasn't an error
>> > on
>> > my part or something in a model I was unaware of. A quick search didn't
>> > show anything in the groups or stackoverflow for this exact issue.
>> > There is
>> > a related issue at
>> >
>> > https://rails.lighthouseapp.com/projects/8994/tickets/4721-schema-dump-does-not-respect-autoincrement
>> >
>> > Here is the schema dump for the table in question:
>> >
>> >> CREATE TABLE `events`.`attendees_packages` (
>> >> `attendee_id` int(11) NOT NULL AUTO_INCREMENT,
>> >> `package_id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY
>> >> (`attendee_id`,
>> >> `package_id`)) DEFAULT CHARSET=latin1,
>> >> COLLATE=latin1_swedish_ci,
>> >> ENGINE=InnoDB;
>> >
>> >
>> > And here is the column information in mysql:
>> >>
>> >> mysql> show full columns from attendees_packages;
>> >>
>> >>
>> >> +-------------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
>> >> | Field | Type | Collation | Null | Key | Default | Extra |
>> >> Privileges | Comment |
>> >>
>> >>
>> >> +-------------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
>> >> | attendee_id | int(11) | NULL | NO | PRI | NULL | |
>> >> select,insert,update,references | |
>> >> | package_id | int(11) | NULL | NO | PRI | NULL | |
>> >> select,insert,update,references | |
>> >>
>> >>
>> >> +-------------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
>> >> 2 rows in set (0.11 sec)
>> >
>> >
>> > It is all of my hasMany association tables.
>> >
>> > Has anybody seen this before? Is it a configuration item I am missing?
>> > Thanks.
>> > John
>> >
>> > --
>> > Like Us on FacekBook https://www.facebook.com/CakePHP
>> > Find us on Twitter http://twitter.com/CakePHP
>> >
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "CakePHP" group.
>> > To post to this group, send email to cake...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > cake-php+u...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >
>> >
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home