<?php

declare(strict_types=1);

namespace DoctrineMigrations\Latest;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20241017132345 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 SEQUENCE commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE statut_commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE TABLE commandes (id INT NOT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, statut BOOLEAN NOT NULL, total DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE TABLE statut_commandes (id INT NOT NULL, commande_id INT DEFAULT NULL, libellé VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX IDX_947ABDEE82EA2E54 ON statut_commandes (commande_id)');
        $this->addSql('ALTER TABLE statut_commandes ADD CONSTRAINT FK_947ABDEE82EA2E54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE SCHEMA public');
        $this->addSql('DROP SEQUENCE commandes_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE statut_commandes_id_seq CASCADE');
        $this->addSql('ALTER TABLE statut_commandes DROP CONSTRAINT FK_947ABDEE82EA2E54');
        $this->addSql('DROP TABLE commandes');
        $this->addSql('DROP TABLE statut_commandes');
    }
}
