44 lines
2.5 KiB
PHP
44 lines
2.5 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 Version20251108214500 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 bundeslaender (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, grunderwerbsteuer NUMERIC(4, 2) NOT NULL, UNIQUE INDEX UNIQ_DF7DFAB25E237E06 (name), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
|
$this->addSql('CREATE TABLE heizungstypen (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, UNIQUE INDEX UNIQ_6161C2A65E237E06 (name), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
|
$this->addSql('ALTER TABLE immobilien ADD nutzflaeche INT NOT NULL, ADD heizungstyp_id INT DEFAULT NULL, ADD bundesland_id INT DEFAULT NULL, DROP flaeche, DROP verfuegbar, DROP heizungstyp, DROP nebenkosten, DROP bundesland, CHANGE preis wohnflaeche INT NOT NULL');
|
|
$this->addSql('ALTER TABLE immobilien ADD CONSTRAINT FK_2C789DC1B4DB52 FOREIGN KEY (heizungstyp_id) REFERENCES heizungstypen (id)');
|
|
$this->addSql('ALTER TABLE immobilien ADD CONSTRAINT FK_2C789DB74FDBEB FOREIGN KEY (bundesland_id) REFERENCES bundeslaender (id)');
|
|
$this->addSql('CREATE INDEX IDX_2C789DC1B4DB52 ON immobilien (heizungstyp_id)');
|
|
$this->addSql('CREATE INDEX IDX_2C789DB74FDBEB ON immobilien (bundesland_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('DROP TABLE bundeslaender');
|
|
$this->addSql('DROP TABLE heizungstypen');
|
|
$this->addSql('ALTER TABLE immobilien DROP FOREIGN KEY FK_2C789DC1B4DB52');
|
|
$this->addSql('ALTER TABLE immobilien DROP FOREIGN KEY FK_2C789DB74FDBEB');
|
|
$this->addSql('DROP INDEX IDX_2C789DC1B4DB52 ON immobilien');
|
|
$this->addSql('DROP INDEX IDX_2C789DB74FDBEB ON immobilien');
|
|
$this->addSql('ALTER TABLE immobilien ADD preis INT NOT NULL, ADD flaeche NUMERIC(8, 2) NOT NULL, ADD verfuegbar TINYINT(1) NOT NULL, ADD heizungstyp VARCHAR(255) DEFAULT NULL, ADD nebenkosten NUMERIC(6, 2) DEFAULT NULL, ADD bundesland VARCHAR(255) DEFAULT NULL, DROP wohnflaeche, DROP nutzflaeche, DROP heizungstyp_id, DROP bundesland_id');
|
|
}
|
|
}
|