<?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 Version20240330094520 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('DROP SEQUENCE user_id_seq CASCADE');
$this->addSql('CREATE SEQUENCE favoris_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
//$this->addSql('CREATE SEQUENCE "users_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE favoris (id INT NOT NULL, utilisateur_id INT NOT NULL, code VARCHAR(20) NOT NULL, product_code VARCHAR(20) NOT NULL, status SMALLINT NOT NULL, categorie_id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_8933C432FB88E14F ON favoris (utilisateur_id)');
$this->addSql('ALTER TABLE favoris ADD CONSTRAINT FK_8933C432FB88E14F FOREIGN KEY (utilisateur_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE users ALTER email SET NOT NULL');
// $this->addSql('ALTER INDEX uniq_8d93d649450ff010 RENAME TO UNIQ_1483A5E9450FF010');
//$this->addSql('ALTER INDEX idx_8d93d6494d16c4dd RENAME TO IDX_1483A5E94D16C4DD');
}
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 favoris_id_seq CASCADE');
$this->addSql('DROP SEQUENCE "users_id_seq" CASCADE');
$this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE favoris DROP CONSTRAINT FK_8933C432FB88E14F');
$this->addSql('DROP TABLE favoris');
$this->addSql('ALTER TABLE "users" ALTER email DROP NOT NULL');
// $this->addSql('ALTER INDEX idx_1483a5e94d16c4dd RENAME TO idx_8d93d6494d16c4dd');
// $this->addSql('ALTER INDEX uniq_1483a5e9450ff010 RENAME TO uniq_8d93d649450ff010');
}
}