<?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 Version20210311142656 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE cal_payment (id INT AUTO_INCREMENT NOT NULL, status VARCHAR(50) DEFAULT NULL, stripe_id VARCHAR(100) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cal_booking ADD payment_id INT DEFAULT NULL, DROP payment_status, DROP payment_stripe_id');
$this->addSql('ALTER TABLE cal_booking ADD CONSTRAINT FK_D7A58FE14C3A3BB FOREIGN KEY (payment_id) REFERENCES cal_booking_document (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D7A58FE14C3A3BB ON cal_booking (payment_id)');
$this->addSql('ALTER TABLE cal_booking_room ADD first_rent_payment_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE cal_booking_room ADD CONSTRAINT FK_9EFEA5D14C119B1 FOREIGN KEY (first_rent_payment_id) REFERENCES cal_booking_document (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_9EFEA5D14C119B1 ON cal_booking_room (first_rent_payment_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE cal_payment');
$this->addSql('ALTER TABLE cal_booking DROP FOREIGN KEY FK_D7A58FE14C3A3BB');
$this->addSql('DROP INDEX UNIQ_D7A58FE14C3A3BB ON cal_booking');
$this->addSql('ALTER TABLE cal_booking ADD payment_status VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD payment_stripe_id VARCHAR(100) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, DROP payment_id');
$this->addSql('ALTER TABLE cal_booking_room DROP FOREIGN KEY FK_9EFEA5D14C119B1');
$this->addSql('DROP INDEX UNIQ_9EFEA5D14C119B1 ON cal_booking_room');
$this->addSql('ALTER TABLE cal_booking_room DROP first_rent_payment_id');
}
}