<?php
declare(strict_types=1);
namespace SalesBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230824094122 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE sales_bundle__payment_expectation (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', year VARCHAR(4) NOT NULL, month VARCHAR(2) NOT NULL, amount NUMERIC(20, 6) NOT NULL, INDEX IDX_BB1ADDCB6B00C1CF (context_id), INDEX year (year), INDEX month (month), INDEX amount (amount), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sales_bundle__payment_expectation ADD CONSTRAINT FK_BB1ADDCB6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sales_bundle__payment_expectation DROP FOREIGN KEY FK_BB1ADDCB6B00C1CF');
$this->addSql('DROP TABLE sales_bundle__payment_expectation');
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$this->connection->insert('cron_job', [
'name' => 'calc-payment-expectations',
'command' => 'bluue-bundle:sales:calc-payment-expectations',
'schedule' => '0 1 1 * *',
'description' => '',
'enabled' => 1
]);
}
}