<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Drop skeleton JSON columns from model_types — data now lives in
 * skeleton_piece_requirements, skeleton_product_requirements,
 * skeleton_subcomponent_requirements and custom_fields tables.
 */
final class Version20260312180000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Drop componentSkeleton, pieceSkeleton, productSkeleton JSON columns from model_types';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS componentskeleton');
        $this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS pieceskeleton');
        $this->addSql('ALTER TABLE model_types DROP COLUMN IF EXISTS productskeleton');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS componentskeleton JSON DEFAULT NULL');
        $this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS pieceskeleton JSON DEFAULT NULL');
        $this->addSql('ALTER TABLE model_types ADD COLUMN IF NOT EXISTS productskeleton JSON DEFAULT NULL');
    }
}
