migrations/Version20210106134817.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 Version20210106134817 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Create tables nuser';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $sql = <<<SQL
  18.             CREATE TABLE IF NOT EXISTS nuser (
  19.                 id INT PRIMARY KEY AUTO_INCREMENT,
  20.                 name VARCHAR(100),
  21.                 email VARCHAR(100) NOT NULL UNIQUE ,
  22.                 password VARCHAR(100),
  23.                 roles VARCHAR(50),
  24.                 reset_hash VARCHAR(255) NULL,
  25.                 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
  26.            );
  27.         SQL;
  28.         $this->addSql($sql);
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         $this->addSql('DROP TABLE nuser');
  33.     }
  34. }