/
home
/
obinna
/
html
/
boaz2
/
migrations
/
Upload File
HOME
<?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 Version20201216101536 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 user_depot DROP FOREIGN KEY FK_A55670E48510D4DE'); $this->addSql('ALTER TABLE user_depot DROP FOREIGN KEY FK_A55670E4A76ED395'); $this->addSql('ALTER TABLE user_depot ADD id INT AUTO_INCREMENT NOT NULL, ADD checkin DATETIME NOT NULL, DROP check_in, CHANGE check_out checkout DATETIME DEFAULT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E48510D4DE FOREIGN KEY (depot_id) REFERENCES depot (id)'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E4A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); } public function down(Schema $schema) : void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE user_depot MODIFY id INT NOT NULL'); $this->addSql('ALTER TABLE user_depot DROP FOREIGN KEY FK_A55670E4A76ED395'); $this->addSql('ALTER TABLE user_depot DROP FOREIGN KEY FK_A55670E48510D4DE'); $this->addSql('ALTER TABLE user_depot DROP PRIMARY KEY'); $this->addSql('ALTER TABLE user_depot ADD check_in DATETIME DEFAULT CURRENT_TIMESTAMP, DROP id, DROP checkin, CHANGE checkout check_out DATETIME DEFAULT NULL'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E4A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON UPDATE NO ACTION ON DELETE CASCADE'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E48510D4DE FOREIGN KEY (depot_id) REFERENCES depot (id) ON UPDATE NO ACTION ON DELETE CASCADE'); $this->addSql('ALTER TABLE user_depot ADD PRIMARY KEY (user_id, depot_id)'); } }