Explorar o código

on delete cascade solo para la db

Luciano Andrade %!s(int64=7) %!d(string=hai) anos
pai
achega
14229606c7
Modificáronse 1 ficheiros con 36 adicións e 0 borrados
  1. 36 0
      app/DoctrineMigrations/Version20180326154629.php

+ 36 - 0
app/DoctrineMigrations/Version20180326154629.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+class Version20180326154629 extends AbstractMigration
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+
+	$this->addSql('ALTER TABLE `service_port` DROP FOREIGN KEY `FK_8DD2E92069FFAD89`; 
+			ALTER TABLE `service_port` ADD CONSTRAINT `FK_8DD2E92069FFAD89` FOREIGN KEY (`olt_id`) REFERENCES `olt`(`id`) ON DELETE SET NULL ON UPDATE RESTRICT; 
+			ALTER TABLE `service_port` DROP FOREIGN KEY `FK_8DD2E920AB83998C`; ALTER TABLE `service_port` ADD CONSTRAINT `FK_8DD2E920AB83998C` FOREIGN KEY (`onu_id`) REFERENCES `onu`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
+	');
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        // this down() migration is auto-generated, please modify it to your needs
+        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+
+    }
+}