vcard4reseller/backend/migrations/Version20260602123707.php
Thomas Peterson f5807aefce Produkte: Produktkatalog-Backend (Visitenkarte/Namensschild/NFC)
- Product-Entität (reseller=null=global, kind, Format-Defaults, sides,
  nfc/print flags, active, sortOrder) als ResellerOwnedInterface
- Sichtbarkeit: global + eigener Reseller (TenantExtension-Sonderfall),
  Schreiben nur Eigentümer (ProductVoter PRODUCT_EDIT), Reseller-Stamping
- CardTemplate koppelt an Product (Design je Firma+Produkt); Editor-,
  Asset- und PDF-Controller produktbewusst (?product=)
- Seed: 3 globale Produkte + 1 Reseller-eigenes; KONZEPT §13 Produktkatalog

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 15:20:52 +02:00

40 lines
2.0 KiB
PHP

<?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 Version20260602123707 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 product (id BINARY(16) NOT NULL, kind VARCHAR(20) NOT NULL, name VARCHAR(120) NOT NULL, description LONGTEXT DEFAULT NULL, width_mm DOUBLE PRECISION NOT NULL, height_mm DOUBLE PRECISION NOT NULL, bleed_mm DOUBLE PRECISION NOT NULL, safe_mm DOUBLE PRECISION NOT NULL, sides SMALLINT NOT NULL, nfc_enabled TINYINT NOT NULL, print_enabled TINYINT NOT NULL, active TINYINT NOT NULL, sort_order INT NOT NULL, created_at DATETIME NOT NULL, reseller_id BINARY(16) DEFAULT NULL, INDEX IDX_D34A04AD91E6A19D (reseller_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD91E6A19D FOREIGN KEY (reseller_id) REFERENCES reseller (id)');
$this->addSql('ALTER TABLE card_template ADD product_id BINARY(16) DEFAULT NULL');
$this->addSql('ALTER TABLE card_template ADD CONSTRAINT FK_2E51D1004584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('CREATE INDEX IDX_2E51D1004584665A ON card_template (product_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD91E6A19D');
$this->addSql('DROP TABLE product');
$this->addSql('ALTER TABLE card_template DROP FOREIGN KEY FK_2E51D1004584665A');
$this->addSql('DROP INDEX IDX_2E51D1004584665A ON card_template');
$this->addSql('ALTER TABLE card_template DROP product_id');
}
}