bazzar/migrations/202204161233_add_cart_state.sql

11 lines
256 B
MySQL
Raw Normal View History

2022-04-16 12:48:38 +02:00
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");