<?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 Version20220919085524 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 budget_category (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_D18348657E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE budget_expense (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, owner_id INT NOT NULL, creation_date DATETIME NOT NULL, info LONGTEXT NOT NULL, value NUMERIC(7, 2) NOT NULL, year INT NOT NULL, month INT NOT NULL, INDEX IDX_EFB9C74712469DE2 (category_id), INDEX IDX_EFB9C7477E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE budget_income (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, owner_id INT NOT NULL, creation_date DATETIME NOT NULL, info LONGTEXT NOT NULL, value NUMERIC(7, 2) NOT NULL, year INT NOT NULL, month INT NOT NULL, INDEX IDX_6B1D246C12469DE2 (category_id), INDEX IDX_6B1D246C7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE budget_recurrent_expense (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, owner_id INT NOT NULL, value NUMERIC(7, 2) NOT NULL, info VARCHAR(255) NOT NULL, yearly TINYINT(1) NOT NULL, monthly TINYINT(1) NOT NULL, INDEX IDX_7F31171112469DE2 (category_id), INDEX IDX_7F3117117E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE budget_recurrent_income (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, owner_id INT NOT NULL, value NUMERIC(7, 2) NOT NULL, info VARCHAR(255) NOT NULL, yearly TINYINT(1) NOT NULL, monthly TINYINT(1) NOT NULL, INDEX IDX_5CD0E36312469DE2 (category_id), INDEX IDX_5CD0E3637E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE budget_category ADD CONSTRAINT FK_D18348657E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE budget_expense ADD CONSTRAINT FK_EFB9C74712469DE2 FOREIGN KEY (category_id) REFERENCES budget_category (id)');
$this->addSql('ALTER TABLE budget_expense ADD CONSTRAINT FK_EFB9C7477E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE budget_income ADD CONSTRAINT FK_6B1D246C12469DE2 FOREIGN KEY (category_id) REFERENCES budget_category (id)');
$this->addSql('ALTER TABLE budget_income ADD CONSTRAINT FK_6B1D246C7E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE budget_recurrent_expense ADD CONSTRAINT FK_7F31171112469DE2 FOREIGN KEY (category_id) REFERENCES budget_category (id)');
$this->addSql('ALTER TABLE budget_recurrent_expense ADD CONSTRAINT FK_7F3117117E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE budget_recurrent_income ADD CONSTRAINT FK_5CD0E36312469DE2 FOREIGN KEY (category_id) REFERENCES budget_category (id)');
$this->addSql('ALTER TABLE budget_recurrent_income ADD CONSTRAINT FK_5CD0E3637E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE budget_expense DROP FOREIGN KEY FK_EFB9C74712469DE2');
$this->addSql('ALTER TABLE budget_income DROP FOREIGN KEY FK_6B1D246C12469DE2');
$this->addSql('ALTER TABLE budget_recurrent_expense DROP FOREIGN KEY FK_7F31171112469DE2');
$this->addSql('ALTER TABLE budget_recurrent_income DROP FOREIGN KEY FK_5CD0E36312469DE2');
$this->addSql('DROP TABLE budget_category');
$this->addSql('DROP TABLE budget_expense');
$this->addSql('DROP TABLE budget_income');
$this->addSql('DROP TABLE budget_recurrent_expense');
$this->addSql('DROP TABLE budget_recurrent_income');
}
}