<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Add caption and lastModified to Asset
 */
class Version20130605174713 extends AbstractMigration
{
    /**
     * @param Schema $schema
     * @return void
     */
    public function up(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");

        $this->addSql("ALTER TABLE typo3_media_domain_model_asset ADD caption TEXT NOT NULL");
        $this->addSql("ALTER TABLE typo3_media_domain_model_asset ADD lastmodified TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL");
    }

    /**
     * @param Schema $schema
     * @return void
     */
    public function down(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql");

        $this->addSql("ALTER TABLE typo3_media_domain_model_asset DROP lastmodified");
        $this->addSql("ALTER TABLE typo3_media_domain_model_asset DROP caption");
    }
}
