Keep messenger_messages out of the migration that resets the database
doctrine:diff kept re-proposing CREATE TABLE messenger_messages, and with it in place app:seed-scenarios --reset failed on a clean database: the doctrine transport creates that table on boot, before migrations run, so the CREATE hit a table that already existed. It is Symfony's table, not ours. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,9 +19,11 @@ final class Version20260801172619 extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// `messenger_messages` عمداً اینجا نیست: transport دکترین خودش میسازدش و
|
||||
// doctrine:diff هر بار دوباره پیشنهادش میدهد. نگهداشتنش یعنی `--reset` روی
|
||||
// دیتابیس تازه میشکند، چون transport پیش از migration آن را ساخته است.
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE resource_service_offerings (id INT AUTO_INCREMENT NOT NULL, duration_minutes SMALLINT DEFAULT NULL, price_rials BIGINT DEFAULT NULL, active TINYINT DEFAULT 1 NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, resource_id INT NOT NULL, service_item_id INT NOT NULL, INDEX IDX_6D71D02D89329D25 (resource_id), INDEX IDX_6D71D02DDDEB00C2 (service_item_id), INDEX idx_offering_service (service_item_id, active), UNIQUE INDEX uniq_resource_service (resource_id, service_item_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750 (queue_name, available_at, delivered_at, id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE resource_service_offerings ADD CONSTRAINT FK_6D71D02D89329D25 FOREIGN KEY (resource_id) REFERENCES clinic_resources (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE resource_service_offerings ADD CONSTRAINT FK_6D71D02DDDEB00C2 FOREIGN KEY (service_item_id) REFERENCES service_items (id) ON DELETE CASCADE');
|
||||
}
|
||||
@@ -32,6 +34,5 @@ final class Version20260801172619 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE resource_service_offerings DROP FOREIGN KEY FK_6D71D02D89329D25');
|
||||
$this->addSql('ALTER TABLE resource_service_offerings DROP FOREIGN KEY FK_6D71D02DDDEB00C2');
|
||||
$this->addSql('DROP TABLE resource_service_offerings');
|
||||
$this->addSql('DROP TABLE messenger_messages');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user