11 lines
256 B
SQL
11 lines
256 B
SQL
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");
|