<?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 Version20260609140423 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 blogs (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, summary VARCHAR(500) DEFAULT NULL, image_url VARCHAR(500) DEFAULT NULL, image_path VARCHAR(500) DEFAULT NULL, tags JSON NOT NULL, status VARCHAR(20) NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, author_id INT NOT NULL, UNIQUE INDEX UNIQ_F41BCA70D17F50A6 (uuid), UNIQUE INDEX UNIQ_F41BCA70989D9B62 (slug), INDEX IDX_F41BCA70F675F31B (author_id), INDEX idx_blogs_status (status, created_at), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE blogs ADD CONSTRAINT FK_F41BCA70F675F31B FOREIGN KEY (author_id) REFERENCES users (id) ON DELETE RESTRICT');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE blogs DROP FOREIGN KEY FK_F41BCA70F675F31B');
        $this->addSql('DROP TABLE blogs');
    }
}
