54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?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 Version20250704091028 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'
|
|
DROP SEQUENCE user_tab_id_seq CASCADE
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE user_tab DROP CONSTRAINT fk_98f5228767b3b43d
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
DROP TABLE user_tab
|
|
SQL);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql(<<<'SQL'
|
|
CREATE SCHEMA public
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE SEQUENCE user_tab_id_seq INCREMENT BY 1 MINVALUE 1 START 1
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE TABLE user_tab (id SERIAL NOT NULL, users_id INT NOT NULL, ip_address VARCHAR(255) NOT NULL, tab_id VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE INDEX idx_98f5228767b3b43d ON user_tab (users_id)
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE user_tab ADD CONSTRAINT fk_98f5228767b3b43d FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
|
SQL);
|
|
}
|
|
}
|