<?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 Version20220801135422 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 endpoind_field_aggregation DROP FOREIGN KEY FK_D33BB461BF62B46E');
$this->addSql('ALTER TABLE endpoind_object_fields DROP FOREIGN KEY FK_9458B7E9BF62B46E');
$this->addSql('CREATE TABLE api_version (id INT AUTO_INCREMENT NOT NULL, api_id INT DEFAULT NULL, version VARCHAR(50) DEFAULT NULL, is_published TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX fk_document_api_id (api_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE endpoind_aggregation (id INT AUTO_INCREMENT NOT NULL, model_field_id INT DEFAULT NULL, endpoind_id INT DEFAULT NULL, child_id INT DEFAULT NULL, layer INT DEFAULT NULL, is_object TINYINT(1) DEFAULT NULL, name VARCHAR(250) DEFAULT NULL, INDEX IDX_CF7623528EED5653 (model_field_id), INDEX IDX_CF76235271B629A9 (endpoind_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE api_version ADD CONSTRAINT FK_5222A7A454963938 FOREIGN KEY (api_id) REFERENCES apis (id)');
$this->addSql('ALTER TABLE endpoind_aggregation ADD CONSTRAINT FK_CF7623528EED5653 FOREIGN KEY (model_field_id) REFERENCES model_fields (id)');
$this->addSql('ALTER TABLE endpoind_aggregation ADD CONSTRAINT FK_CF76235271B629A9 FOREIGN KEY (endpoind_id) REFERENCES endpoinds (id)');
$this->addSql('DROP TABLE endpoind_field_aggregation');
$this->addSql('DROP TABLE endpoind_fields');
$this->addSql('DROP TABLE endpoind_object_fields');
$this->addSql('ALTER TABLE endpoind_path_fields DROP FOREIGN KEY FK_4C853E323C78ABF');
$this->addSql('ALTER TABLE endpoind_path_fields DROP FOREIGN KEY FK_4C853E3267BFE15');
$this->addSql('DROP INDEX fk__endpoind_path_static_fields ON endpoind_path_fields');
$this->addSql('DROP INDEX IDX_4C853E3267BFE15 ON endpoind_path_fields');
$this->addSql('ALTER TABLE endpoind_path_fields ADD model_field_id INT DEFAULT NULL, DROP static_field_type_id, DROP static_field_format_id, DROP name');
$this->addSql('ALTER TABLE endpoind_path_fields ADD CONSTRAINT FK_4C853E328EED5653 FOREIGN KEY (model_field_id) REFERENCES model_fields (id)');
$this->addSql('CREATE INDEX IDX_4C853E328EED5653 ON endpoind_path_fields (model_field_id)');
$this->addSql('ALTER TABLE endpoinds ADD model_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE endpoinds ADD CONSTRAINT FK_96DF37E17975B7E7 FOREIGN KEY (model_id) REFERENCES models (id)');
$this->addSql('CREATE INDEX IDX_96DF37E17975B7E7 ON endpoinds (model_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE endpoind_field_aggregation (id INT AUTO_INCREMENT NOT NULL, endpoind_field_id INT DEFAULT NULL, model_field_id INT DEFAULT NULL, child_id INT DEFAULT NULL, layer INT DEFAULT NULL, is_object TINYINT(1) DEFAULT NULL, INDEX IDX_D33BB4618EED5653 (model_field_id), INDEX IDX_D33BB461BF62B46E (endpoind_field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE endpoind_fields (id INT AUTO_INCREMENT NOT NULL, static_field_type_id INT DEFAULT NULL, endpoind_id INT DEFAULT NULL, object_model_id INT DEFAULT NULL, static_field_format_id INT DEFAULT NULL, name VARCHAR(250) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, example_value VARCHAR(250) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, is_sortable TINYINT(1) DEFAULT NULL, is_searchable TINYINT(1) DEFAULT NULL, required TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_3F48715C67BFE15 (static_field_format_id), INDEX fk_endpoind (endpoind_id), INDEX fk__static_fields (static_field_type_id), INDEX fk_object_model (object_model_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE endpoind_object_fields (id INT AUTO_INCREMENT NOT NULL, endpoind_field_id INT DEFAULT NULL, model_field_id INT DEFAULT NULL, is_sortable TINYINT(1) DEFAULT NULL, INDEX fk_model_field (model_field_id), INDEX fk_endpoind_field (endpoind_field_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE endpoind_field_aggregation ADD CONSTRAINT FK_D33BB4618EED5653 FOREIGN KEY (model_field_id) REFERENCES model_fields (id)');
$this->addSql('ALTER TABLE endpoind_field_aggregation ADD CONSTRAINT FK_D33BB461BF62B46E FOREIGN KEY (endpoind_field_id) REFERENCES endpoind_fields (id)');
$this->addSql('ALTER TABLE endpoind_fields ADD CONSTRAINT FK_3F48715C3C78ABF FOREIGN KEY (static_field_type_id) REFERENCES static_fields (id)');
$this->addSql('ALTER TABLE endpoind_fields ADD CONSTRAINT FK_3F48715C67BFE15 FOREIGN KEY (static_field_format_id) REFERENCES static_field_formats (id)');
$this->addSql('ALTER TABLE endpoind_fields ADD CONSTRAINT FK_3F48715C71B629A9 FOREIGN KEY (endpoind_id) REFERENCES endpoinds (id)');
$this->addSql('ALTER TABLE endpoind_fields ADD CONSTRAINT FK_3F48715CAFA35A8F FOREIGN KEY (object_model_id) REFERENCES models (id)');
$this->addSql('ALTER TABLE endpoind_object_fields ADD CONSTRAINT FK_9458B7E98EED5653 FOREIGN KEY (model_field_id) REFERENCES model_fields (id)');
$this->addSql('ALTER TABLE endpoind_object_fields ADD CONSTRAINT FK_9458B7E9BF62B46E FOREIGN KEY (endpoind_field_id) REFERENCES endpoind_fields (id)');
$this->addSql('DROP TABLE api_version');
$this->addSql('DROP TABLE endpoind_aggregation');
$this->addSql('ALTER TABLE endpoind_path_fields DROP FOREIGN KEY FK_4C853E328EED5653');
$this->addSql('DROP INDEX IDX_4C853E328EED5653 ON endpoind_path_fields');
$this->addSql('ALTER TABLE endpoind_path_fields ADD static_field_format_id INT DEFAULT NULL, ADD name VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE model_field_id static_field_type_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE endpoind_path_fields ADD CONSTRAINT FK_4C853E323C78ABF FOREIGN KEY (static_field_type_id) REFERENCES static_fields (id)');
$this->addSql('ALTER TABLE endpoind_path_fields ADD CONSTRAINT FK_4C853E3267BFE15 FOREIGN KEY (static_field_format_id) REFERENCES static_field_formats (id)');
$this->addSql('CREATE INDEX fk__endpoind_path_static_fields ON endpoind_path_fields (static_field_type_id)');
$this->addSql('CREATE INDEX IDX_4C853E3267BFE15 ON endpoind_path_fields (static_field_format_id)');
$this->addSql('ALTER TABLE endpoinds DROP FOREIGN KEY FK_96DF37E17975B7E7');
$this->addSql('DROP INDEX IDX_96DF37E17975B7E7 ON endpoinds');
$this->addSql('ALTER TABLE endpoinds DROP model_id');
}
}