kekrozsak/app/DoctrineMigrations/Version20120823160202.php

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");
}
}