migrations/Version20240330094520.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240330094520 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.       ///  $this->addSql('DROP SEQUENCE user_id_seq CASCADE');
  19.         $this->addSql('CREATE SEQUENCE favoris_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  20.         //$this->addSql('CREATE SEQUENCE "users_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
  21.         $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))');
  22.         $this->addSql('CREATE INDEX IDX_8933C432FB88E14F ON favoris (utilisateur_id)');
  23.         $this->addSql('ALTER TABLE favoris ADD CONSTRAINT FK_8933C432FB88E14F FOREIGN KEY (utilisateur_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.         $this->addSql('ALTER TABLE users ALTER email SET NOT NULL');
  25.       //  $this->addSql('ALTER INDEX uniq_8d93d649450ff010 RENAME TO UNIQ_1483A5E9450FF010');
  26.         //$this->addSql('ALTER INDEX idx_8d93d6494d16c4dd RENAME TO IDX_1483A5E94D16C4DD');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('CREATE SCHEMA public');
  32.         $this->addSql('DROP SEQUENCE favoris_id_seq CASCADE');
  33.         $this->addSql('DROP SEQUENCE "users_id_seq" CASCADE');
  34.         $this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  35.         $this->addSql('ALTER TABLE favoris DROP CONSTRAINT FK_8933C432FB88E14F');
  36.         $this->addSql('DROP TABLE favoris');
  37.         $this->addSql('ALTER TABLE "users" ALTER email DROP NOT NULL');
  38.       //  $this->addSql('ALTER INDEX idx_1483a5e94d16c4dd RENAME TO idx_8d93d6494d16c4dd');
  39.        // $this->addSql('ALTER INDEX uniq_1483a5e9450ff010 RENAME TO uniq_8d93d649450ff010');
  40.     }
  41. }