NYCPHP Meetup

NYPHP.org

[nycphp-talk] Doctrine and auto_increment not being a primary key

jean-baptiste verrey jeanbaptiste.verrey at gmail.com
Sat Dec 11 10:20:14 EST 2010


ok to make it quick:
 it means that I simply should have id as a primary key and use unique for
the fields that makes the row unique!?

CREATE TABLE user(
          id INTEGER(10) NOT NULL AUTO_INCREMENT,
          firstName VARCHAR(32),
          lastName VARCHAR(32)
          PRIMARY KEY(id),
          UNIQUE(firstName,lastName)
)
(or something like that)

For the issue of the 2 people having the same names it just means that I
need more information such as address or email OR I should have a different
primary key (or no primary key at all) ????

Otherwise Is this way of creating table can be used for pretty much every
table ? (except like association table) ?

Anyway thanks for the answers, at least It can be done with Doctrine!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101211/c3fe1791/attachment.html>


More information about the talk mailing list