bazzar/migrations/202204161233_add_cart_state.sql
2022-05-04 21:34:26 +02:00

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");