You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EvoLyte/migrations/Version20250610074721.php

91 lines
3.3 KiB

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250610074721 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TABLE stock_emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL)
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) NOT NULL)
SQL);
$this->addSql(<<<'SQL'
CREATE UNIQUE INDEX UNIQ_8D93D649F85E0677 ON user (username)
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE posseder (user_id INTEGER NOT NULL, emoji_id INTEGER NOT NULL, PRIMARY KEY(user_id, emoji_id), CONSTRAINT FK_62EF7CBAA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_62EF7CBAE2462A5B FOREIGN KEY (emoji_id) REFERENCES emoji (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_62EF7CBAA76ED395 ON posseder (user_id)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_62EF7CBAE2462A5B ON posseder (emoji_id)
SQL);
$this->addSql(<<<'SQL'
CREATE TEMPORARY TABLE __temp__rarity AS SELECT id, name, drop_rate FROM rarity
SQL);
$this->addSql(<<<'SQL'
DROP TABLE rarity
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE rarity (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(50) NOT NULL, drop_rate DOUBLE PRECISION NOT NULL)
SQL);
$this->addSql(<<<'SQL'
INSERT INTO rarity (id, name, drop_rate) SELECT id, name, drop_rate FROM __temp__rarity
SQL);
$this->addSql(<<<'SQL'
DROP TABLE __temp__rarity
SQL);
$this->addSql(<<<'SQL'
CREATE UNIQUE INDEX UNIQ_B7C0BE465E237E06 ON rarity (name)
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP TABLE stock_emoji
SQL);
$this->addSql(<<<'SQL'
DROP TABLE user
SQL);
$this->addSql(<<<'SQL'
DROP TABLE posseder
SQL);
$this->addSql(<<<'SQL'
CREATE TEMPORARY TABLE __temp__rarity AS SELECT id, name, drop_rate FROM rarity
SQL);
$this->addSql(<<<'SQL'
DROP TABLE rarity
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE rarity (id INTEGER DEFAULT NULL, name VARCHAR(255) NOT NULL, drop_rate DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))
SQL);
$this->addSql(<<<'SQL'
INSERT INTO rarity (id, name, drop_rate) SELECT id, name, drop_rate FROM __temp__rarity
SQL);
$this->addSql(<<<'SQL'
DROP TABLE __temp__rarity
SQL);
}
}