DROP TABLE IF EXISTS order_product_option;

-- DROP SEQUENCE IF EXISTS order_product_option_order_product_option_id_seq;
-- CREATE SEQUENCE order_product_option_order_product_option_id_seq;


CREATE TABLE order_product_option (
  "order_product_option_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "order_id" int check ("order_id" > 0) NOT NULL,
  "order_product_id" int check ("order_product_id" > 0) NOT NULL,
  "product_option_id" int check ("product_option_id" > 0) NOT NULL,
  "product_option_value_id" int check ("product_option_value_id" > 0) NOT NULL DEFAULT 0,
  "option" varchar(191) NOT NULL,
  "name" varchar(191) NOT NULL,
  "price" decimal(15,4) NOT NULL DEFAULT 0.0000,
  "type" varchar(32) NOT NULL DEFAULT ''
  -- PRIMARY KEY("order_product_option_id")
);

-- SELECT setval('order_product_option_order_product_option_id_seq', 0, true); -- last inserted id by sample data