migrations/Version20240617063738.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 Version20240617063738 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('CREATE SEQUENCE t_admin_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE TABLE t_admin_user (id INT NOT NULL, token VARCHAR(255) DEFAULT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
  20.         $this->addSql('CREATE UNIQUE INDEX UNIQ_F9DF69D9F85E0677 ON t_admin_user (username)');
  21.         $this->addSql('CREATE TABLE t_role (id SERIAL NOT NULL, users_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
  22.         $this->addSql('CREATE INDEX IDX_ED1FE31867B3B43D ON t_role (users_id)');
  23.         $this->addSql('ALTER TABLE t_role ADD CONSTRAINT FK_ED1FE31867B3B43D FOREIGN KEY (users_id) REFERENCES t_admin_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('CREATE SCHEMA public');
  29.         $this->addSql('DROP SEQUENCE t_admin_user_id_seq CASCADE');
  30.         $this->addSql('ALTER TABLE t_role DROP CONSTRAINT FK_ED1FE31867B3B43D');
  31.         $this->addSql('DROP TABLE t_admin_user');
  32.         $this->addSql('DROP TABLE t_role');
  33.     }
  34. }