<?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 Version20230222183425 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function isTransactional(): bool
{
return false;
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE cart (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, service_id INT NOT NULL, subtotal NUMERIC(10, 2) NOT NULL, tax NUMERIC(10, 2) NOT NULL, tax_amount NUMERIC(10, 2) NOT NULL, discount_amount NUMERIC(10, 2) NOT NULL, total NUMERIC(10, 2) NOT NULL, stripe_session_id VARCHAR(255) DEFAULT NULL, stripe_expired_at DATETIME DEFAULT NULL, hash VARCHAR(255) NOT NULL, status INT NOT NULL, is_removed TINYINT(1) NOT NULL, cdate DATETIME NOT NULL, mdate DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_BA388B7D1B862B8 (hash), INDEX IDX_BA388B79395C3F3 (customer_id), INDEX IDX_BA388B7ED5CA9E6 (service_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cart ADD CONSTRAINT FK_BA388B79395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE cart ADD CONSTRAINT FK_BA388B7ED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id)');
$this->addSql('ALTER TABLE orders DROP stripe_session_id, DROP stripe_expired_at');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE cart');
$this->addSql('ALTER TABLE orders ADD stripe_session_id VARCHAR(255) DEFAULT NULL, ADD stripe_expired_at DATETIME DEFAULT NULL');
}
}