kekrozsak/app/DoctrineMigrations/Version20120827162130.php

32 lines
1.7 KiB
PHP

<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120827162130 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 blog_posts (id INT AUTO_INCREMENT NOT NULL, group_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT DEFAULT NULL, published TINYINT(1) NOT NULL, title VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, update_reason VARCHAR(255) DEFAULT NULL, content LONGTEXT NOT NULL, INDEX IDX_78B2F932FE54D947 (group_id), INDEX IDX_78B2F932B03A8386 (created_by_id), INDEX IDX_78B2F932896DBBDE (updated_by_id), PRIMARY KEY(id)) ENGINE = InnoDB");
$this->addSql("ALTER TABLE blog_posts ADD CONSTRAINT FK_78B2F932FE54D947 FOREIGN KEY (group_id) REFERENCES groups (id)");
$this->addSql("ALTER TABLE blog_posts ADD CONSTRAINT FK_78B2F932B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)");
$this->addSql("ALTER TABLE blog_posts ADD CONSTRAINT FK_78B2F932896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (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 blog_posts");
}
}