<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220116222541 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE invoice (id INT AUTO_INCREMENT NOT NULL, auction_id INT DEFAULT NULL, client_id INT DEFAULT NULL, shipping_id INT DEFAULT NULL, invoice_id VARCHAR(255) NOT NULL, country VARCHAR(255) NOT NULL, sum INT NOT NULL, status INT NOT NULL, note LONGTEXT DEFAULT NULL, INDEX IDX_9065174457B8F0DE (auction_id), INDEX IDX_9065174419EB6921 (client_id), INDEX IDX_906517444887F3F8 (shipping_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE payment (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, provider INT NOT NULL, INDEX IDX_6D28840DA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE shipping (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_9065174457B8F0DE FOREIGN KEY (auction_id) REFERENCES auction (id)');
$this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_9065174419EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
$this->addSql('ALTER TABLE invoice ADD CONSTRAINT FK_906517444887F3F8 FOREIGN KEY (shipping_id) REFERENCES shipping (id)');
$this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user CHANGE status status INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE invoice DROP FOREIGN KEY FK_906517444887F3F8');
$this->addSql('DROP TABLE invoice');
$this->addSql('DROP TABLE payment');
$this->addSql('DROP TABLE shipping');
$this->addSql('ALTER TABLE user CHANGE status status TINYINT(1) DEFAULT NULL');
}
}