fix: preferred chapter fix

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-06-26 14:51:00 +02:00
parent d753761556
commit 4dc6e5cfab
6 changed files with 162 additions and 25 deletions

View File

@@ -0,0 +1,46 @@
<?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 Version20250626123300 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('DROP SEQUENCE manga_preferred_source_order_id_seq CASCADE');
$this->addSql('CREATE SEQUENCE manga_preferred_sources_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE manga_preferred_sources (id INT NOT NULL, manga_id INT NOT NULL, ordered_source_ids JSON NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_manga_preferred_sources_manga_id ON manga_preferred_sources (manga_id)');
$this->addSql('COMMENT ON COLUMN manga_preferred_sources.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN manga_preferred_sources.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('DROP TABLE manga_preferred_source_order');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE manga_preferred_sources_id_seq CASCADE');
$this->addSql('CREATE SEQUENCE manga_preferred_source_order_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE manga_preferred_source_order (id INT NOT NULL, manga_id INT NOT NULL, source_id INT NOT NULL, "position" INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_source_id ON manga_preferred_source_order (source_id)');
$this->addSql('CREATE INDEX idx_manga_id ON manga_preferred_source_order (manga_id)');
$this->addSql('CREATE UNIQUE INDEX unique_manga_source ON manga_preferred_source_order (manga_id, source_id)');
$this->addSql('COMMENT ON COLUMN manga_preferred_source_order.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('DROP INDEX UNIQ_manga_preferred_sources_manga_id');
$this->addSql('DROP TABLE manga_preferred_sources');
}
}