<?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 Version20230326170924 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 facture (id INT AUTO_INCREMENT NOT NULL, abonnement_id INT DEFAULT NULL, collect_id INT DEFAULT NULL, stripe_id VARCHAR(255) NOT NULL, hosted_url VARCHAR(255) NOT NULL, download_url VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, slug VARCHAR(180) NOT NULL, UNIQUE INDEX UNIQ_FE866410989D9B62 (slug), INDEX IDX_FE866410F1D74413 (abonnement_id), UNIQUE INDEX UNIQ_FE8664106A24B288 (collect_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recynews (id INT AUTO_INCREMENT NOT NULL, position INT NOT NULL, content LONGTEXT NOT NULL, title VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE facture ADD CONSTRAINT FK_FE866410F1D74413 FOREIGN KEY (abonnement_id) REFERENCES abonnement (id)');
$this->addSql('ALTER TABLE facture ADD CONSTRAINT FK_FE8664106A24B288 FOREIGN KEY (collect_id) REFERENCES collect (id)');
$this->addSql('ALTER TABLE abonnement ADD email VARCHAR(255) NOT NULL, ADD name VARCHAR(255) NOT NULL, ADD price DOUBLE PRECISION NOT NULL, CHANGE stripe_id stripe_id VARCHAR(255) DEFAULT NULL, CHANGE customer_id customer_id VARCHAR(255) DEFAULT NULL, CHANGE session_id session_id VARCHAR(255) DEFAULT NULL, CHANGE method_payment method_payment VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collect ADD paid TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE enterprise ADD stripe_customer_id VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD reset_token VARCHAR(255) DEFAULT NULL, ADD stripe_id VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE facture DROP FOREIGN KEY FK_FE866410F1D74413');
$this->addSql('ALTER TABLE facture DROP FOREIGN KEY FK_FE8664106A24B288');
$this->addSql('DROP TABLE facture');
$this->addSql('DROP TABLE recynews');
$this->addSql('ALTER TABLE enterprise DROP stripe_customer_id');
$this->addSql('ALTER TABLE collect DROP paid');
$this->addSql('ALTER TABLE user DROP reset_token, DROP stripe_id');
$this->addSql('ALTER TABLE abonnement DROP email, DROP name, DROP price, CHANGE stripe_id stripe_id VARCHAR(255) NOT NULL, CHANGE customer_id customer_id VARCHAR(255) NOT NULL, CHANGE session_id session_id VARCHAR(255) NOT NULL, CHANGE method_payment method_payment VARCHAR(255) NOT NULL');
}
}