symfony-playground/migrations/Version20220523110817.php

37 lines
1.6 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 Version20220523110817 extends AbstractMigration
{
public function getDescription(): string
{
return 'Be* added';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mer_service ADD COLUMN activation_code VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_service AS SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM mer_service');
$this->addSql('DROP TABLE mer_service');
$this->addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json)
, discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, offer_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, service_id VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO mer_service (id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id) SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM __temp__mer_service');
$this->addSql('DROP TABLE __temp__mer_service');
}
}