Skip to content

Commit

Permalink
[framework] added unique constraint to cart (#3017)
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin authored Feb 15, 2024
1 parent a28ec71 commit d8be6af
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Migrations/Version20240209114704.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Shopsys\FrameworkBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Shopsys\MigrationBundle\Component\Doctrine\Migrations\AbstractMigration;

class Version20240209114704 extends AbstractMigration
{
/**
* @param \Doctrine\DBAL\Schema\Schema $schema
*/
public function up(Schema $schema): void
{
$this->sql('CREATE UNIQUE INDEX cart_identifier ON carts (cart_identifier) WHERE cart_identifier <> \'\';');
$this->sql('CREATE UNIQUE INDEX customer_user_id ON carts (customer_user_id);');
}

/**
* @param \Doctrine\DBAL\Schema\Schema $schema
*/
public function down(Schema $schema): void
{
}
}

0 comments on commit d8be6af

Please sign in to comment.