<?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 Version20240419125916 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 sms_message (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, building_id INT NOT NULL, flat_id INT NOT NULL, text VARCHAR(2048) DEFAULT NULL, type INT DEFAULT NULL, created_at DATETIME NOT NULL, sent_at DATETIME DEFAULT NULL, INDEX IDX_46A7FBA5A76ED395 (user_id), INDEX IDX_46A7FBA54D2A7E12 (building_id), INDEX IDX_46A7FBA5D3331C94 (flat_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sms_message ADD CONSTRAINT FK_46A7FBA5A76ED395 FOREIGN KEY (user_id) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE sms_message ADD CONSTRAINT FK_46A7FBA54D2A7E12 FOREIGN KEY (building_id) REFERENCES building (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sms_message ADD CONSTRAINT FK_46A7FBA5D3331C94 FOREIGN KEY (flat_id) REFERENCES flat (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sms_message DROP FOREIGN KEY FK_46A7FBA5A76ED395');
$this->addSql('ALTER TABLE sms_message DROP FOREIGN KEY FK_46A7FBA54D2A7E12');
$this->addSql('ALTER TABLE sms_message DROP FOREIGN KEY FK_46A7FBA5D3331C94');
$this->addSql('DROP TABLE sms_message');
}
}