<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20261024120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Rename the Spanish column names (nombre, direccion, telefono, tel_whatsapp, precio, id_restaurante) to English';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE menu DROP FOREIGN KEY FK_7D053A9341450F82');
$this->addSql('DROP INDEX IDX_7D053A9341450F82 ON menu');
$this->addSql('ALTER TABLE menu CHANGE id_restaurante restaurant_id INT DEFAULT NULL, CHANGE precio price NUMERIC(10, 4) NOT NULL');
$this->addSql('ALTER TABLE menu ADD CONSTRAINT FK_7D053A93B1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurante (id)');
$this->addSql('CREATE INDEX IDX_7D053A93B1E7706E ON menu (restaurant_id)');
$this->addSql('ALTER TABLE restaurante CHANGE nombre name VARCHAR(255) NOT NULL, CHANGE direccion address VARCHAR(255) NOT NULL, CHANGE telefono phone INT NOT NULL, CHANGE tel_whatsapp whatsapp_phone INT DEFAULT NULL');
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045F41450F82');
$this->addSql('DROP INDEX IDX_C53D045F41450F82 ON image');
$this->addSql('ALTER TABLE image CHANGE id_restaurante restaurant_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045FB1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurante (id)');
$this->addSql('CREATE INDEX IDX_C53D045FB1E7706E ON image (restaurant_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045FB1E7706E');
$this->addSql('DROP INDEX IDX_C53D045FB1E7706E ON image');
$this->addSql('ALTER TABLE image CHANGE restaurant_id id_restaurante INT DEFAULT NULL');
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F41450F82 FOREIGN KEY (id_restaurante) REFERENCES restaurante (id)');
$this->addSql('CREATE INDEX IDX_C53D045F41450F82 ON image (id_restaurante)');
$this->addSql('ALTER TABLE restaurante CHANGE name nombre VARCHAR(255) NOT NULL, CHANGE address direccion VARCHAR(255) NOT NULL, CHANGE phone telefono INT NOT NULL, CHANGE whatsapp_phone tel_whatsapp INT DEFAULT NULL');
$this->addSql('ALTER TABLE menu DROP FOREIGN KEY FK_7D053A93B1E7706E');
$this->addSql('DROP INDEX IDX_7D053A93B1E7706E ON menu');
$this->addSql('ALTER TABLE menu CHANGE restaurant_id id_restaurante INT DEFAULT NULL, CHANGE price precio NUMERIC(10, 4) NOT NULL');
$this->addSql('ALTER TABLE menu ADD CONSTRAINT FK_7D053A9341450F82 FOREIGN KEY (id_restaurante) REFERENCES restaurante (id)');
$this->addSql('CREATE INDEX IDX_7D053A9341450F82 ON menu (id_restaurante)');
}
}