<?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 Version20200904204817 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE checking_account_movement DROP FOREIGN KEY FK_E22B6B12F0B3EF62');
$this->addSql('DROP TABLE checking_account');
$this->addSql('DROP TABLE checking_account_movement');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE checking_account (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, isEnable TINYINT(1) NOT NULL, total NUMERIC(10, 2) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, idClient INT DEFAULT NULL, balance NUMERIC(10, 2) NOT NULL, INDEX IDX_23EB7C35B03A8386 (created_by_id), INDEX IDX_23EB7C35896DBBDE (updated_by_id), INDEX IDX_23EB7C35A455ACCF (idClient), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE checking_account_movement (id INT AUTO_INCREMENT NOT NULL, checking_account_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, movement_type VARCHAR(20) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, amount NUMERIC(10, 2) NOT NULL, notes TEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, balance NUMERIC(10, 2) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_C5DB54A0B03A8386 (created_by_id), INDEX IDX_C5DB54A0896DBBDE (updated_by_id), INDEX IDX_C5DB54A0F0B3EF62 (checking_account_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE checking_account ADD CONSTRAINT FK_23EB7C35896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE checking_account ADD CONSTRAINT FK_23EB7C35A455ACCF FOREIGN KEY (idClient) REFERENCES customer (id)');
$this->addSql('ALTER TABLE checking_account ADD CONSTRAINT FK_23EB7C35B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE checking_account_movement ADD CONSTRAINT FK_E22B6B12896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE checking_account_movement ADD CONSTRAINT FK_E22B6B12B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE checking_account_movement ADD CONSTRAINT FK_E22B6B12F0B3EF62 FOREIGN KEY (checking_account_id) REFERENCES checking_account (id)');
}
}