<?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 Version20240617063738 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('CREATE SEQUENCE t_admin_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE t_admin_user (id INT NOT NULL, token VARCHAR(255) DEFAULT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F9DF69D9F85E0677 ON t_admin_user (username)');
$this->addSql('CREATE TABLE t_role (id SERIAL NOT NULL, users_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_ED1FE31867B3B43D ON t_role (users_id)');
$this->addSql('ALTER TABLE t_role ADD CONSTRAINT FK_ED1FE31867B3B43D FOREIGN KEY (users_id) REFERENCES t_admin_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE t_admin_user_id_seq CASCADE');
$this->addSql('ALTER TABLE t_role DROP CONSTRAINT FK_ED1FE31867B3B43D');
$this->addSql('DROP TABLE t_admin_user');
$this->addSql('DROP TABLE t_role');
}
}