11 lines
256 B
MySQL
11 lines
256 B
MySQL
|
CREATE TYPE "ShoppingCartState" AS ENUM (
|
||
|
'active',
|
||
|
'closed'
|
||
|
);
|
||
|
|
||
|
ALTER TABLE shopping_carts
|
||
|
ADD COLUMN "state" "ShoppingCartState" NOT NULL DEFAULT 'active';
|
||
|
|
||
|
ALTER TABLE shopping_carts
|
||
|
ADD CONSTRAINT single_active_cart UNIQUE (buyer_id, "state");
|