INSERT INTO app.platforms WHERE NOT EXISTS — idempotent, safe to run on existing installations. Fixes "eBay-Platform nicht konfiguriert" error when opening the eBay category config CRUD. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
40834a8bd6
commit
f1d3ee6b1e
1 changed files with 30 additions and 0 deletions
30
migrations/Version20260520110000.php
Normal file
30
migrations/Version20260520110000.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20260520110000 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Seed eBay platform row if not present';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql(<<<'SQL'
|
||||||
|
INSERT INTO app.platforms (id, type, label, config)
|
||||||
|
SELECT gen_random_uuid(), 'ebay', 'eBay', '[]'
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM app.platforms WHERE type = 'ebay')
|
||||||
|
SQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("DELETE FROM app.platforms WHERE type = 'ebay'");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue