<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220817173529 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add devices table';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE device (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', creator_id BIGINT UNSIGNED DEFAULT NULL, push_token LONGTEXT NOT NULL, platform VARCHAR(50) NOT NULL, app_version VARCHAR(50) NOT NULL, timezone VARCHAR(50) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_92FB68E61220EA6 (creator_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE device ADD CONSTRAINT FK_92FB68E61220EA6 FOREIGN KEY (creator_id) REFERENCES creator (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE device');
}
public function isTransactional(): bool
{
return false;
}
}