migrations/Version20251219145312.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 Version20251219145312 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Create new entity UserOAuth and add phoneVerified field to Customer entity';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE user_oauth (id INT AUTO_INCREMENT NOT NULL, phone VARCHAR(255) NOT NULL, code VARCHAR(6) NOT NULL, attempts INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE user ADD phone_verified TINYINT(1) DEFAULT 0');
  16.     }
  17.     public function down(Schema $schema): void
  18.     {
  19.         $this->addSql('DROP TABLE user_oauth');
  20.         $this->addSql('ALTER TABLE user DROP phone_verified');
  21.     }
  22. }