/
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 Version20201208070726 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 user_depot (user_id INT NOT NULL, depot_id INT NOT NULL, check_in DATETIME DEFAULT CURRENT_TIMESTAMP, check_out DATETIME, INDEX IDX_A55670E4A76ED395 (user_id), INDEX IDX_A55670E48510D4DE (depot_id), PRIMARY KEY(user_id, depot_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E4A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE user_depot ADD CONSTRAINT FK_A55670E48510D4DE FOREIGN KEY (depot_id) REFERENCES depot (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE loading ADD depot_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE loading ADD CONSTRAINT FK_576038B48510D4DE FOREIGN KEY (depot_id) REFERENCES depot (id)'); $this->addSql('CREATE INDEX IDX_576038B48510D4DE ON loading (depot_id)'); } public function down(Schema $schema) : void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('DROP TABLE user_depot'); $this->addSql('ALTER TABLE loading DROP FOREIGN KEY FK_576038B48510D4DE'); $this->addSql('DROP INDEX IDX_576038B48510D4DE ON loading'); $this->addSql('ALTER TABLE loading DROP depot_id'); } }