<?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 Version20221117001832 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 media_earning (id INT AUTO_INCREMENT NOT NULL, media_id INT NOT NULL, month INT NOT NULL, year INT NOT NULL, earning_confirmed DOUBLE PRECISION NOT NULL, earning_estimated DOUBLE PRECISION NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_D1D89768EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE notification_publisher (id INT AUTO_INCREMENT NOT NULL, action_by_id INT DEFAULT NULL, post_id INT DEFAULT NULL, media_id INT DEFAULT NULL, program_id INT DEFAULT NULL, comment_id INT DEFAULT NULL, user_id INT DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, title VARCHAR(180) DEFAULT NULL, description LONGTEXT DEFAULT NULL, number_of INT DEFAULT NULL, is_new TINYINT(1) NOT NULL, is_consulted TINYINT(1) NOT NULL, action_date DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_3A0192194D29ECB8 (action_by_id), INDEX IDX_3A0192194B89032C (post_id), INDEX IDX_3A019219EA9FDD75 (media_id), INDEX IDX_3A0192193EB8070A (program_id), INDEX IDX_3A019219F8697D13 (comment_id), INDEX IDX_3A019219A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE post_earning (id INT AUTO_INCREMENT NOT NULL, post_id INT NOT NULL, month INT NOT NULL, year INT NOT NULL, earning_confirmed DOUBLE PRECISION NOT NULL, earning_estimated DOUBLE PRECISION NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_8DE7A6124B89032C (post_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE program_earning (id INT AUTO_INCREMENT NOT NULL, program_id INT NOT NULL, month INT NOT NULL, year INT NOT NULL, earning_confirmed DOUBLE PRECISION NOT NULL, earning_estimated DOUBLE PRECISION NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_3BE5E9F53EB8070A (program_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE settings_by_ssp (id INT AUTO_INCREMENT NOT NULL, settings_id INT NOT NULL, ssp_name VARCHAR(256) NOT NULL, state INT NOT NULL, estimated_earning_total DOUBLE PRECISION DEFAULT NULL, estimated_earning_net DOUBLE PRECISION DEFAULT NULL, confirmed_earning_total DOUBLE PRECISION DEFAULT NULL, confirmed_earning_net DOUBLE PRECISION DEFAULT NULL, confirmed_file VARCHAR(255) DEFAULT NULL, confirmed_file_upload_date_time DATETIME DEFAULT CURRENT_TIMESTAMP, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_9E4A3FCA59949888 (settings_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE media_earning ADD CONSTRAINT FK_D1D89768EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A0192194D29ECB8 FOREIGN KEY (action_by_id) REFERENCES user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A0192194B89032C FOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A019219EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A0192193EB8070A FOREIGN KEY (program_id) REFERENCES program (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A019219F8697D13 FOREIGN KEY (comment_id) REFERENCES comment (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE notification_publisher ADD CONSTRAINT FK_3A019219A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE post_earning ADD CONSTRAINT FK_8DE7A6124B89032C FOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE program_earning ADD CONSTRAINT FK_3BE5E9F53EB8070A FOREIGN KEY (program_id) REFERENCES program (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE settings_by_ssp ADD CONSTRAINT FK_9E4A3FCA59949888 FOREIGN KEY (settings_id) REFERENCES settings (id)');
$this->addSql('ALTER TABLE by_country DROP FOREIGN KEY FK_28813EC759949888');
$this->addSql('DROP INDEX IDX_28813EC759949888 ON by_country');
$this->addSql('ALTER TABLE by_country ADD estimated_earning_total DOUBLE PRECISION DEFAULT NULL, ADD estimated_earning_net DOUBLE PRECISION DEFAULT NULL, ADD confirmed_earning_total DOUBLE PRECISION DEFAULT NULL, ADD confirmed_earning_net DOUBLE PRECISION DEFAULT NULL, CHANGE unit unit VARCHAR(256) DEFAULT NULL, CHANGE settings_id ssp_id INT NOT NULL');
$this->addSql('ALTER TABLE by_country ADD CONSTRAINT FK_28813EC77039F86D FOREIGN KEY (ssp_id) REFERENCES settings_by_ssp (id)');
$this->addSql('CREATE INDEX IDX_28813EC77039F86D ON by_country (ssp_id)');
$this->addSql('ALTER TABLE estimated_file DROP FOREIGN KEY FK_C84680AA59949888');
$this->addSql('DROP INDEX IDX_C84680AA59949888 ON estimated_file');
$this->addSql('ALTER TABLE estimated_file CHANGE settings_id ssp_id INT NOT NULL');
$this->addSql('ALTER TABLE estimated_file ADD CONSTRAINT FK_C84680AA7039F86D FOREIGN KEY (ssp_id) REFERENCES settings_by_ssp (id)');
$this->addSql('CREATE INDEX IDX_C84680AA7039F86D ON estimated_file (ssp_id)');
$this->addSql('ALTER TABLE media ADD level INT NOT NULL');
$this->addSql('ALTER TABLE post CHANGE description description LONGTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE program CHANGE date_to date_to DATE DEFAULT NULL');
$this->addSql('ALTER TABLE settings DROP confirmed_file, DROP confirmed_file_upload_date_time');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE by_country DROP FOREIGN KEY FK_28813EC77039F86D');
$this->addSql('ALTER TABLE estimated_file DROP FOREIGN KEY FK_C84680AA7039F86D');
$this->addSql('DROP TABLE media_earning');
$this->addSql('DROP TABLE notification_publisher');
$this->addSql('DROP TABLE post_earning');
$this->addSql('DROP TABLE program_earning');
$this->addSql('DROP TABLE settings_by_ssp');
$this->addSql('DROP INDEX IDX_28813EC77039F86D ON by_country');
$this->addSql('ALTER TABLE by_country DROP estimated_earning_total, DROP estimated_earning_net, DROP confirmed_earning_total, DROP confirmed_earning_net, CHANGE unit unit VARCHAR(256) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE ssp_id settings_id INT NOT NULL');
$this->addSql('ALTER TABLE by_country ADD CONSTRAINT FK_28813EC759949888 FOREIGN KEY (settings_id) REFERENCES settings (id)');
$this->addSql('CREATE INDEX IDX_28813EC759949888 ON by_country (settings_id)');
$this->addSql('DROP INDEX IDX_C84680AA7039F86D ON estimated_file');
$this->addSql('ALTER TABLE estimated_file CHANGE ssp_id settings_id INT NOT NULL');
$this->addSql('ALTER TABLE estimated_file ADD CONSTRAINT FK_C84680AA59949888 FOREIGN KEY (settings_id) REFERENCES settings (id)');
$this->addSql('CREATE INDEX IDX_C84680AA59949888 ON estimated_file (settings_id)');
$this->addSql('ALTER TABLE media DROP level');
$this->addSql('ALTER TABLE post CHANGE description description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE program CHANGE date_to date_to DATE NOT NULL');
$this->addSql('ALTER TABLE settings ADD confirmed_file VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD confirmed_file_upload_date_time DATETIME DEFAULT CURRENT_TIMESTAMP');
}
}