Fixed initial Doctrine migrations file

Added ForumTopic title and slug unique constraints

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2012-08-23 17:08:38 +02:00
parent 9457373710
commit 22ea2cd2ef

View File

@ -49,7 +49,7 @@ class Version20120731113533 extends AbstractMigration
$this->addSql("CREATE TABLE forum_topic_groups (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, createdAt DATETIME NOT NULL, slug VARCHAR(100) NOT NULL, title VARCHAR(100) NOT NULL, UNIQUE INDEX UNIQ_6BB4FCEF989D9B62 (slug), UNIQUE INDEX UNIQ_6BB4FCEF2B36786B (title), INDEX IDX_6BB4FCEFB03A8386 (created_by_id), PRIMARY KEY(id)) ENGINE = InnoDB"); $this->addSql("CREATE TABLE forum_topic_groups (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, createdAt DATETIME NOT NULL, slug VARCHAR(100) NOT NULL, title VARCHAR(100) NOT NULL, UNIQUE INDEX UNIQ_6BB4FCEF989D9B62 (slug), UNIQUE INDEX UNIQ_6BB4FCEF2B36786B (title), INDEX IDX_6BB4FCEFB03A8386 (created_by_id), PRIMARY KEY(id)) ENGINE = InnoDB");
$this->addSql("ALTER TABLE forum_topic_groups ADD CONSTRAINT FK_6BB4FCEFB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)"); $this->addSql("ALTER TABLE forum_topic_groups ADD CONSTRAINT FK_6BB4FCEFB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)");
$this->addSql("CREATE TABLE forum_topics (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, topic_group_id INT DEFAULT NULL, last_post_id INT DEFAULT NULL, created_at DATETIME NOT NULL, slug VARCHAR(100) NOT NULL, title VARCHAR(100) NOT NULL, INDEX IDX_895975E8B03A8386 (created_by_id), INDEX IDX_895975E88655441 (topic_group_id), UNIQUE INDEX UNIQ_895975E82D053F64 (last_post_id), PRIMARY KEY(id)) ENGINE = InnoDB"); $this->addSql("CREATE TABLE forum_topics (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, topic_group_id INT DEFAULT NULL, last_post_id INT DEFAULT NULL, created_at DATETIME NOT NULL, slug VARCHAR(100) NOT NULL, title VARCHAR(100) NOT NULL, INDEX IDX_895975E8B03A8386 (created_by_id), INDEX IDX_895975E88655441 (topic_group_id), UNIQUE INDEX UNIQ_895975E82D053F64 (last_post_id), UNIQUE INDEX UNIQ_895975E886554412B36786B (topic_group_id, title), UNIQUE INDEX UNIQ_895975E88655441989D9B62 (topic_group_id, slug), PRIMARY KEY(id)) ENGINE = InnoDB");
$this->addSql("ALTER TABLE forum_topics ADD CONSTRAINT FK_895975E8B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)"); $this->addSql("ALTER TABLE forum_topics ADD CONSTRAINT FK_895975E8B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)");
$this->addSql("ALTER TABLE forum_topics ADD CONSTRAINT FK_895975E88655441 FOREIGN KEY (topic_group_id) REFERENCES forum_topic_groups (id)"); $this->addSql("ALTER TABLE forum_topics ADD CONSTRAINT FK_895975E88655441 FOREIGN KEY (topic_group_id) REFERENCES forum_topic_groups (id)");