migrations/Version20221203144519.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. final class Version20221203144519 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add refresh token';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         // this up() migration is auto-generated, please modify it to your needs
  15.         $this->addSql('CREATE SEQUENCE refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  16.         $this->addSql('CREATE TABLE refresh_tokens (id INT NOT NULL, refresh_token VARCHAR(128) NOT NULL, username VARCHAR(255) NOT NULL, valid TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
  17.         $this->addSql('CREATE UNIQUE INDEX UNIQ_9BACE7E1C74F2195 ON refresh_tokens (refresh_token)');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         $this->addSql('DROP SEQUENCE refresh_tokens_id_seq CASCADE');
  22.         $this->addSql('DROP TABLE refresh_tokens');
  23.     }
  24. }