kekrozsak/app/DoctrineMigrations/Version20120823160202.php
Gergely Polonkai (W00d5t0ck) 6bdb9530a3 Added forum topic favourite function
Solves issue #12

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
2012-08-23 19:06:26 +02:00

31 lines
1.3 KiB
PHP

<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120823160202 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("CREATE TABLE user_favourite_forum_topics (user_id INT NOT NULL, forum_topic_id INT NOT NULL, INDEX IDX_917D04B0A76ED395 (user_id), INDEX IDX_917D04B038A6ADDA (forum_topic_id), PRIMARY KEY(user_id, forum_topic_id)) ENGINE = InnoDB");
$this->addSql("ALTER TABLE user_favourite_forum_topics ADD CONSTRAINT FK_917D04B0A76ED395 FOREIGN KEY (user_id) REFERENCES user_data (user_id)");
$this->addSql("ALTER TABLE user_favourite_forum_topics ADD CONSTRAINT FK_917D04B038A6ADDA FOREIGN KEY (forum_topic_id) REFERENCES forum_topics (id)");
}
public function down(Schema $schema)
{
// this down() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("DROP TABLE user_favourite_forum_topics");
}
}