<?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 Version20230427133318 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 sport_object_rent (id SERIAL NOT NULL, sport_object_id INT NOT NULL, removed_by_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, contacts JSON DEFAULT NULL, removed_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_FC5835998AFAE46 ON sport_object_rent (sport_object_id)');
$this->addSql('CREATE INDEX IDX_FC5835992BD701DA ON sport_object_rent (removed_by_id)');
$this->addSql('COMMENT ON TABLE sport_object_rent IS \'Аренда на спорт.объекте\'');
$this->addSql('COMMENT ON COLUMN sport_object_rent.title IS \'Наименование аренды\'');
$this->addSql('COMMENT ON COLUMN sport_object_rent.content IS \'Описание аренды (html)\'');
$this->addSql('COMMENT ON COLUMN sport_object_rent.contacts IS \'Контакты (тел.номера)\'');
$this->addSql('COMMENT ON COLUMN sport_object_rent.removed_at IS \'Когда удалено\'');
$this->addSql('ALTER TABLE sport_object_rent ADD CONSTRAINT FK_FC5835998AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_rent ADD CONSTRAINT FK_FC5835992BD701DA FOREIGN KEY (removed_by_id) REFERENCES "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('ALTER TABLE sport_object_rent DROP CONSTRAINT FK_FC5835998AFAE46');
$this->addSql('ALTER TABLE sport_object_rent DROP CONSTRAINT FK_FC5835992BD701DA');
$this->addSql('DROP TABLE sport_object_rent');
}
}