feat: hello PostgreSQL

This commit is contained in:
Maël Gangloff 2024-07-26 21:10:06 +02:00
parent 467d0efa1c
commit f72f6df546
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
15 changed files with 142 additions and 437 deletions

View File

@ -1,91 +0,0 @@
<?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 Version20240719183550 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 TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) NOT NULL, status CLOB NOT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
$this->addSql('CREATE TABLE domain_nameservers (domain_ldh_name VARCHAR(255) NOT NULL, nameserver_ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(domain_ldh_name, nameserver_ldh_name), CONSTRAINT FK_B6E6B63AAF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B6E6B63AA6496BFE FOREIGN KEY (nameserver_ldh_name) REFERENCES nameserver (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_B6E6B63AAF923913 ON domain_nameservers (domain_ldh_name)');
$this->addSql('CREATE INDEX IDX_B6E6B63AA6496BFE ON domain_nameservers (nameserver_ldh_name)');
$this->addSql('CREATE TABLE domain_entity (domain_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles CLOB NOT NULL --(DC2Type:simple_array)
, PRIMARY KEY(domain_id, entity_id), CONSTRAINT FK_614B48A1115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_614B48A181257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_614B48A1115F0EE5 ON domain_entity (domain_id)');
$this->addSql('CREATE INDEX IDX_614B48A181257D5D ON domain_entity (entity_id)');
$this->addSql('CREATE TABLE domain_event (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, domain_id VARCHAR(255) NOT NULL, "action" VARCHAR(255) NOT NULL, date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, CONSTRAINT FK_E8D52271115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_E8D52271115F0EE5 ON domain_event (domain_id)');
$this->addSql('CREATE TABLE entity (handle VARCHAR(255) NOT NULL, j_card CLOB NOT NULL --(DC2Type:json)
, PRIMARY KEY(handle))');
$this->addSql('CREATE TABLE entity_event (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, entity_id VARCHAR(255) NOT NULL, "action" VARCHAR(255) NOT NULL, date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, CONSTRAINT FK_975A3F5E81257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_975A3F5E81257D5D ON entity_event (entity_id)');
$this->addSql('CREATE TABLE nameserver (ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(ldh_name))');
$this->addSql('CREATE TABLE nameserver_entity (nameserver_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles CLOB NOT NULL --(DC2Type:simple_array)
, status CLOB NOT NULL --(DC2Type:simple_array)
, PRIMARY KEY(nameserver_id, entity_id), CONSTRAINT FK_A269AFB41A555619 FOREIGN KEY (nameserver_id) REFERENCES nameserver (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A269AFB481257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_A269AFB41A555619 ON nameserver_entity (nameserver_id)');
$this->addSql('CREATE INDEX IDX_A269AFB481257D5D ON nameserver_entity (entity_id)');
$this->addSql('CREATE TABLE rdap_server (url VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(url, tld_id), CONSTRAINT FK_CCBF17A850F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_CCBF17A850F7084E ON rdap_server (tld_id)');
$this->addSql('CREATE TABLE tld (tld VARCHAR(63) NOT NULL, contract_terminated BOOLEAN DEFAULT NULL, date_of_contract_signature DATE DEFAULT NULL --(DC2Type:date_immutable)
, delegation_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, registry_operator VARCHAR(255) DEFAULT NULL, removal_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, specification13 BOOLEAN DEFAULT NULL, PRIMARY KEY(tld))');
$this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
$this->addSql('CREATE TABLE watch_list (token VARCHAR(36) NOT NULL, user_id INTEGER NOT NULL, PRIMARY KEY(token), CONSTRAINT FK_152B584BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_152B584BA76ED395 ON watch_list (user_id)');
$this->addSql('CREATE TABLE watch_lists_domains (watch_list_token VARCHAR(36) NOT NULL, domain_ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(watch_list_token, domain_ldh_name), CONSTRAINT FK_F693E1D0D52D7AA6 FOREIGN KEY (watch_list_token) REFERENCES watch_list (token) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_F693E1D0AF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_F693E1D0D52D7AA6 ON watch_lists_domains (watch_list_token)');
$this->addSql('CREATE INDEX IDX_F693E1D0AF923913 ON watch_lists_domains (domain_ldh_name)');
$this->addSql('CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE domain');
$this->addSql('DROP TABLE domain_nameservers');
$this->addSql('DROP TABLE domain_entity');
$this->addSql('DROP TABLE domain_event');
$this->addSql('DROP TABLE entity');
$this->addSql('DROP TABLE entity_event');
$this->addSql('DROP TABLE nameserver');
$this->addSql('DROP TABLE nameserver_entity');
$this->addSql('DROP TABLE rdap_server');
$this->addSql('DROP TABLE tld');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE watch_list');
$this->addSql('DROP TABLE watch_lists_domains');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -1,32 +0,0 @@
<?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 Version20240720210058 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 TABLE watch_list_trigger (event VARCHAR(255) NOT NULL, "action" VARCHAR(255) NOT NULL, watch_list_id VARCHAR(36) NOT NULL, PRIMARY KEY(event, watch_list_id, "action"), CONSTRAINT FK_CF857A4CC4508918 FOREIGN KEY (watch_list_id) REFERENCES watch_list (token) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_CF857A4CC4508918 ON watch_list_trigger (watch_list_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE watch_list_trigger');
}
}

View File

@ -1,43 +0,0 @@
<?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 Version20240722125047 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 TEMPORARY TABLE __temp__user AS SELECT id, email, roles, password FROM user');
$this->addSql('DROP TABLE user');
$this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO user (id, email, roles, password) SELECT id, email, roles, password FROM __temp__user');
$this->addSql('DROP TABLE __temp__user');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__user AS SELECT id, email, roles, password FROM user');
$this->addSql('DROP TABLE user');
$this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
, password VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO user (id, email, roles, password) SELECT id, email, roles, password FROM __temp__user');
$this->addSql('DROP TABLE __temp__user');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
}
}

View File

@ -1,47 +0,0 @@
<?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 Version20240722233219 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 TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB NOT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at) SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) NOT NULL, status CLOB NOT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at) SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
}

View File

@ -1,47 +0,0 @@
<?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 Version20240723122603 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 TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB DEFAULT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at) SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB NOT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at) SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
}

View File

@ -1,38 +0,0 @@
<?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 Version20240724160636 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('ALTER TABLE tld ADD COLUMN type VARCHAR(10) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__tld AS SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13 FROM tld');
$this->addSql('DROP TABLE tld');
$this->addSql('CREATE TABLE tld (tld VARCHAR(63) NOT NULL, contract_terminated BOOLEAN DEFAULT NULL, date_of_contract_signature DATE DEFAULT NULL --(DC2Type:date_immutable)
, delegation_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, registry_operator VARCHAR(255) DEFAULT NULL, removal_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, specification13 BOOLEAN DEFAULT NULL, PRIMARY KEY(tld))');
$this->addSql('INSERT INTO tld (tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13) SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13 FROM __temp__tld');
$this->addSql('DROP TABLE __temp__tld');
}
}

View File

@ -1,45 +0,0 @@
<?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 Version20240724201612 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 TEMPORARY TABLE __temp__tld AS SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type FROM tld');
$this->addSql('DROP TABLE tld');
$this->addSql('CREATE TABLE tld (tld VARCHAR(63) NOT NULL, contract_terminated BOOLEAN DEFAULT NULL, date_of_contract_signature DATE DEFAULT NULL --(DC2Type:date_immutable)
, delegation_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, registry_operator VARCHAR(255) DEFAULT NULL, removal_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, specification13 BOOLEAN DEFAULT NULL, type VARCHAR(10) NOT NULL, PRIMARY KEY(tld))');
$this->addSql('INSERT INTO tld (tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type) SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type FROM __temp__tld');
$this->addSql('DROP TABLE __temp__tld');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__tld AS SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type FROM tld');
$this->addSql('DROP TABLE tld');
$this->addSql('CREATE TABLE tld (tld VARCHAR(63) NOT NULL, contract_terminated BOOLEAN DEFAULT NULL, date_of_contract_signature DATE DEFAULT NULL --(DC2Type:date_immutable)
, delegation_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, registry_operator VARCHAR(255) DEFAULT NULL, removal_date DATE DEFAULT NULL --(DC2Type:date_immutable)
, specification13 BOOLEAN DEFAULT NULL, type VARCHAR(10) DEFAULT NULL, PRIMARY KEY(tld))');
$this->addSql('INSERT INTO tld (tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type) SELECT tld, contract_terminated, date_of_contract_signature, delegation_date, registry_operator, removal_date, specification13, type FROM __temp__tld');
$this->addSql('DROP TABLE __temp__tld');
}
}

View File

@ -1,39 +0,0 @@
<?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 Version20240725140219 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('ALTER TABLE domain ADD COLUMN deleted BOOLEAN DEFAULT 0');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB DEFAULT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at) SELECT ldh_name, tld_id, handle, status, created_at, updated_at FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
}

View File

@ -1,47 +0,0 @@
<?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 Version20240725140319 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 TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at, deleted FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB DEFAULT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, deleted BOOLEAN NOT NULL, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at, deleted) SELECT ldh_name, tld_id, handle, status, created_at, updated_at, deleted FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__domain AS SELECT ldh_name, tld_id, handle, status, created_at, updated_at, deleted FROM domain');
$this->addSql('DROP TABLE domain');
$this->addSql('CREATE TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status CLOB DEFAULT NULL --(DC2Type:simple_array)
, created_at DATE NOT NULL --(DC2Type:date_immutable)
, updated_at DATE NOT NULL --(DC2Type:date_immutable)
, deleted BOOLEAN DEFAULT 0, PRIMARY KEY(ldh_name), CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO domain (ldh_name, tld_id, handle, status, created_at, updated_at, deleted) SELECT ldh_name, tld_id, handle, status, created_at, updated_at, deleted FROM __temp__domain');
$this->addSql('DROP TABLE __temp__domain');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
}
}

View File

@ -0,0 +1,132 @@
<?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 Version20240726182804 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 TABLE domain (ldh_name VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, handle VARCHAR(255) DEFAULT NULL, status TEXT DEFAULT NULL, created_at DATE NOT NULL, updated_at DATE NOT NULL, deleted BOOLEAN NOT NULL, PRIMARY KEY(ldh_name))');
$this->addSql('CREATE INDEX IDX_A7A91E0B50F7084E ON domain (tld_id)');
$this->addSql('COMMENT ON COLUMN domain.status IS \'(DC2Type:simple_array)\'');
$this->addSql('COMMENT ON COLUMN domain.created_at IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN domain.updated_at IS \'(DC2Type:date_immutable)\'');
$this->addSql('CREATE TABLE domain_nameservers (domain_ldh_name VARCHAR(255) NOT NULL, nameserver_ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(domain_ldh_name, nameserver_ldh_name))');
$this->addSql('CREATE INDEX IDX_B6E6B63AAF923913 ON domain_nameservers (domain_ldh_name)');
$this->addSql('CREATE INDEX IDX_B6E6B63AA6496BFE ON domain_nameservers (nameserver_ldh_name)');
$this->addSql('CREATE TABLE domain_entity (domain_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles TEXT NOT NULL, PRIMARY KEY(domain_id, entity_id))');
$this->addSql('CREATE INDEX IDX_614B48A1115F0EE5 ON domain_entity (domain_id)');
$this->addSql('CREATE INDEX IDX_614B48A181257D5D ON domain_entity (entity_id)');
$this->addSql('COMMENT ON COLUMN domain_entity.roles IS \'(DC2Type:simple_array)\'');
$this->addSql('CREATE TABLE domain_event (id INT NOT NULL, domain_id VARCHAR(255) NOT NULL, action VARCHAR(255) NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_E8D52271115F0EE5 ON domain_event (domain_id)');
$this->addSql('COMMENT ON COLUMN domain_event.date IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE entity (handle VARCHAR(255) NOT NULL, j_card JSON NOT NULL, PRIMARY KEY(handle))');
$this->addSql('CREATE TABLE entity_event (id INT NOT NULL, entity_id VARCHAR(255) NOT NULL, action VARCHAR(255) NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_975A3F5E81257D5D ON entity_event (entity_id)');
$this->addSql('COMMENT ON COLUMN entity_event.date IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE nameserver (ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(ldh_name))');
$this->addSql('CREATE TABLE nameserver_entity (nameserver_id VARCHAR(255) NOT NULL, entity_id VARCHAR(255) NOT NULL, roles TEXT NOT NULL, status TEXT NOT NULL, PRIMARY KEY(nameserver_id, entity_id))');
$this->addSql('CREATE INDEX IDX_A269AFB41A555619 ON nameserver_entity (nameserver_id)');
$this->addSql('CREATE INDEX IDX_A269AFB481257D5D ON nameserver_entity (entity_id)');
$this->addSql('COMMENT ON COLUMN nameserver_entity.roles IS \'(DC2Type:simple_array)\'');
$this->addSql('COMMENT ON COLUMN nameserver_entity.status IS \'(DC2Type:simple_array)\'');
$this->addSql('CREATE TABLE rdap_server (url VARCHAR(255) NOT NULL, tld_id VARCHAR(63) NOT NULL, updated_at DATE NOT NULL, PRIMARY KEY(url, tld_id))');
$this->addSql('CREATE INDEX IDX_CCBF17A850F7084E ON rdap_server (tld_id)');
$this->addSql('COMMENT ON COLUMN rdap_server.updated_at IS \'(DC2Type:date_immutable)\'');
$this->addSql('CREATE TABLE tld (tld VARCHAR(63) NOT NULL, contract_terminated BOOLEAN DEFAULT NULL, date_of_contract_signature DATE DEFAULT NULL, delegation_date DATE DEFAULT NULL, registry_operator VARCHAR(255) DEFAULT NULL, removal_date DATE DEFAULT NULL, specification13 BOOLEAN DEFAULT NULL, type VARCHAR(10) NOT NULL, PRIMARY KEY(tld))');
$this->addSql('COMMENT ON COLUMN tld.date_of_contract_signature IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN tld.delegation_date IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN tld.removal_date IS \'(DC2Type:date_immutable)\'');
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
$this->addSql('CREATE TABLE watch_list (token UUID NOT NULL, user_id INT NOT NULL, PRIMARY KEY(token))');
$this->addSql('CREATE INDEX IDX_152B584BA76ED395 ON watch_list (user_id)');
$this->addSql('COMMENT ON COLUMN watch_list.token IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE watch_lists_domains (watch_list_token UUID NOT NULL, domain_ldh_name VARCHAR(255) NOT NULL, PRIMARY KEY(watch_list_token, domain_ldh_name))');
$this->addSql('CREATE INDEX IDX_F693E1D0D52D7AA6 ON watch_lists_domains (watch_list_token)');
$this->addSql('CREATE INDEX IDX_F693E1D0AF923913 ON watch_lists_domains (domain_ldh_name)');
$this->addSql('COMMENT ON COLUMN watch_lists_domains.watch_list_token IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE watch_list_trigger (event VARCHAR(255) NOT NULL, action VARCHAR(255) NOT NULL, watch_list_id UUID NOT NULL, PRIMARY KEY(event, watch_list_id, action))');
$this->addSql('CREATE INDEX IDX_CF857A4CC4508918 ON watch_list_trigger (watch_list_id)');
$this->addSql('COMMENT ON COLUMN watch_list_trigger.watch_list_id IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE domain ADD CONSTRAINT FK_A7A91E0B50F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE domain_nameservers ADD CONSTRAINT FK_B6E6B63AAF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE domain_nameservers ADD CONSTRAINT FK_B6E6B63AA6496BFE FOREIGN KEY (nameserver_ldh_name) REFERENCES nameserver (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE domain_entity ADD CONSTRAINT FK_614B48A1115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE domain_entity ADD CONSTRAINT FK_614B48A181257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE domain_event ADD CONSTRAINT FK_E8D52271115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE entity_event ADD CONSTRAINT FK_975A3F5E81257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE nameserver_entity ADD CONSTRAINT FK_A269AFB41A555619 FOREIGN KEY (nameserver_id) REFERENCES nameserver (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE nameserver_entity ADD CONSTRAINT FK_A269AFB481257D5D FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE rdap_server ADD CONSTRAINT FK_CCBF17A850F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_list ADD CONSTRAINT FK_152B584BA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT FK_F693E1D0D52D7AA6 FOREIGN KEY (watch_list_token) REFERENCES watch_list (token) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_lists_domains ADD CONSTRAINT FK_F693E1D0AF923913 FOREIGN KEY (domain_ldh_name) REFERENCES domain (ldh_name) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE watch_list_trigger ADD CONSTRAINT FK_CF857A4CC4508918 FOREIGN KEY (watch_list_id) REFERENCES watch_list (token) 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('ALTER TABLE domain DROP CONSTRAINT FK_A7A91E0B50F7084E');
$this->addSql('ALTER TABLE domain_nameservers DROP CONSTRAINT FK_B6E6B63AAF923913');
$this->addSql('ALTER TABLE domain_nameservers DROP CONSTRAINT FK_B6E6B63AA6496BFE');
$this->addSql('ALTER TABLE domain_entity DROP CONSTRAINT FK_614B48A1115F0EE5');
$this->addSql('ALTER TABLE domain_entity DROP CONSTRAINT FK_614B48A181257D5D');
$this->addSql('ALTER TABLE domain_event DROP CONSTRAINT FK_E8D52271115F0EE5');
$this->addSql('ALTER TABLE entity_event DROP CONSTRAINT FK_975A3F5E81257D5D');
$this->addSql('ALTER TABLE nameserver_entity DROP CONSTRAINT FK_A269AFB41A555619');
$this->addSql('ALTER TABLE nameserver_entity DROP CONSTRAINT FK_A269AFB481257D5D');
$this->addSql('ALTER TABLE rdap_server DROP CONSTRAINT FK_CCBF17A850F7084E');
$this->addSql('ALTER TABLE watch_list DROP CONSTRAINT FK_152B584BA76ED395');
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT FK_F693E1D0D52D7AA6');
$this->addSql('ALTER TABLE watch_lists_domains DROP CONSTRAINT FK_F693E1D0AF923913');
$this->addSql('ALTER TABLE watch_list_trigger DROP CONSTRAINT FK_CF857A4CC4508918');
$this->addSql('DROP TABLE domain');
$this->addSql('DROP TABLE domain_nameservers');
$this->addSql('DROP TABLE domain_entity');
$this->addSql('DROP TABLE domain_event');
$this->addSql('DROP TABLE entity');
$this->addSql('DROP TABLE entity_event');
$this->addSql('DROP TABLE nameserver');
$this->addSql('DROP TABLE nameserver_entity');
$this->addSql('DROP TABLE rdap_server');
$this->addSql('DROP TABLE tld');
$this->addSql('DROP TABLE "user"');
$this->addSql('DROP TABLE watch_list');
$this->addSql('DROP TABLE watch_lists_domains');
$this->addSql('DROP TABLE watch_list_trigger');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -5,11 +5,10 @@ namespace App\Command;
use App\Message\UpdateRdapServers;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface;
#[AsCommand(
@ -18,7 +17,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
)]
class UpdateRdapServersCommand extends Command
{
public function __construct(private MessageBusInterface $bus)
public function __construct(private readonly MessageBusInterface $bus)
{
parent::__construct();
}
@ -27,6 +26,9 @@ class UpdateRdapServersCommand extends Command
{
}
/**
* @throws ExceptionInterface
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

View File

@ -16,6 +16,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
#[ORM\Table(name: "`user`")]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
#[ApiResource(
operations: [

View File

@ -42,7 +42,7 @@ use Symfony\Component\Uid\Uuid;
class WatchList
{
#[ORM\Id]
#[ORM\Column(length: 36)]
#[ORM\Column(type: 'uuid')]
#[Groups(['watchlist:item', 'watchlist:list'])]
private string $token;

View File

@ -4,7 +4,6 @@ namespace App\MessageHandler;
use App\Message\UpdateRdapServers;
use App\Service\RDAPService;
use Symfony\Component\Intl\Countries;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;

View File

@ -129,7 +129,7 @@ readonly class RDAPService
*/
public function registerDomain(string $fqdn): Domain
{
$idnDomain = idn_to_ascii($fqdn);
$idnDomain = strtolower(idn_to_ascii($fqdn));
$tld = $this->getTld($idnDomain);
/** @var RdapServer|null $rdapServer */
@ -138,7 +138,7 @@ readonly class RDAPService
if ($rdapServer === null) throw new Exception("Unable to determine which RDAP server to contact");
/** @var ?Domain $domain */
$domain = $this->domainRepository->findOneBy(["ldhName" => strtolower($idnDomain)]);
$domain = $this->domainRepository->findOneBy(["ldhName" => $idnDomain]);
try {
@ -157,7 +157,7 @@ readonly class RDAPService
if ($domain === null) $domain = new Domain();
$domain->setTld($tld)->setLdhName($res['ldhName'])->setDeleted(false);
$domain->setTld($tld)->setLdhName($idnDomain)->setDeleted(false);
if (array_key_exists('status', $res)) $domain->setStatus($res['status']);
if (array_key_exists('handle', $res)) $domain->setHandle($res['handle']);