<?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 Version20230416232419 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 input_output_invoice (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, building_id INT NOT NULL, partner_id INT NOT NULL, date DATETIME NOT NULL, type INT DEFAULT 0 NOT NULL, amount DOUBLE PRECISION DEFAULT \'0\' NOT NULL, invoice_number VARCHAR(64) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_37748D2DA76ED395 (user_id), INDEX IDX_37748D2D4D2A7E12 (building_id), INDEX IDX_37748D2D9393F8FE (partner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE input_output_invoice ADD CONSTRAINT FK_37748D2DA76ED395 FOREIGN KEY (user_id) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE input_output_invoice ADD CONSTRAINT FK_37748D2D4D2A7E12 FOREIGN KEY (building_id) REFERENCES building (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE input_output_invoice ADD CONSTRAINT FK_37748D2D9393F8FE FOREIGN KEY (partner_id) REFERENCES partners (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE input_output_invoice DROP FOREIGN KEY FK_37748D2DA76ED395');
$this->addSql('ALTER TABLE input_output_invoice DROP FOREIGN KEY FK_37748D2D4D2A7E12');
$this->addSql('ALTER TABLE input_output_invoice DROP FOREIGN KEY FK_37748D2D9393F8FE');
$this->addSql('DROP TABLE input_output_invoice');
}
}