czydojade/api/migrations/Version20181027124203.php
2020-11-30 00:39:53 +01:00

37 lines
1.8 KiB
PHP

<?php declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181027124203 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('CREATE TEMPORARY TABLE __temp__provider AS SELECT id, name, class FROM provider');
$this->addSql('DROP TABLE provider');
$this->addSql('CREATE TABLE provider (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, update_date DATETIME NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY(id))');
$this->addSql('INSERT INTO provider (id, name, class) SELECT id, name, class FROM __temp__provider');
$this->addSql('DROP TABLE __temp__provider');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('CREATE TEMPORARY TABLE __temp__provider AS SELECT id, name, class FROM provider');
$this->addSql('DROP TABLE provider');
$this->addSql('CREATE TABLE provider (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('INSERT INTO provider (id, name, class) SELECT id, name, class FROM __temp__provider');
$this->addSql('DROP TABLE __temp__provider');
}
}