Created
March 23, 2013 17:32
-
-
Save jaytaph/5228598 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\DemoBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="Foo", uniqueConstraints={ | |
@ORM\UniqueConstraint(name="fullname",columns={"firstname", "lastname"}), | |
@ORM\UniqueConstraint(name="uniq_key",columns={"key"}) | |
}) | |
*/ | |
class Foo { | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
*/ | |
private $id; | |
/** | |
* @ORM\Column(type="string", length=40) | |
*/ | |
private $firstname; | |
/** | |
* @ORM\Column(type="string", length=40) | |
*/ | |
private $lastname; | |
/** | |
* @ORM\Column(type="string", length=40) | |
*/ | |
private $key; | |
} | |
/* | |
Doctrine:schema:create will generate: | |
CREATE TABLE Foo (id INT NOT NULL, firstname VARCHAR(40) NOT NULL, lastname VARCHAR(40) NOT NULL, `key` VARCHAR(40) NOT NULL, `varchar` VARCHAR(40) NOT NULL, UNIQUE INDEX fullname (firstname, lastname), UNIQUE INDEX uniqkey (key), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB | |
but it should generate: | |
... UNIQUE INDEX uniqkey (`key`), PRIMARY KEY(id)) ... | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment