-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from jacquesbh/fix/undefined-shipment
Fix undefined shipment.order
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Monsieur Biz' Shipping Slot plugin for Sylius. | ||
* | ||
* (c) Monsieur Biz <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MonsieurBiz\SyliusShippingSlotPlugin\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20210915210206 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Cascade shipment deletion to slot deletion. Also remove slots without shipment.'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('DELETE FROM monsieurbiz_shipping_slot_slot WHERE shipment_id IS NULL'); | ||
$this->addSql('ALTER TABLE monsieurbiz_shipping_slot_slot DROP FOREIGN KEY FK_3BD6F1F67BE036FC'); | ||
$this->addSql('ALTER TABLE monsieurbiz_shipping_slot_slot ADD CONSTRAINT FK_3BD6F1F67BE036FC FOREIGN KEY (shipment_id) REFERENCES sylius_shipment (id) ON DELETE CASCADE'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE monsieurbiz_shipping_slot_slot DROP FOREIGN KEY FK_3BD6F1F67BE036FC'); | ||
$this->addSql('ALTER TABLE monsieurbiz_shipping_slot_slot ADD CONSTRAINT FK_3BD6F1F67BE036FC FOREIGN KEY (shipment_id) REFERENCES sylius_shipment (id) ON DELETE SET NULL'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters