DROP TABLE IF EXISTS product_points;

-- DROP SEQUENCE IF EXISTS product_points_product_points_id_seq;
-- CREATE SEQUENCE product_points_product_points_id_seq;


CREATE TABLE product_points (
  "product_points_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "product_id" int check ("product_id" > 0) NOT NULL DEFAULT 0,
  "user_group_id" int check ("user_group_id" > 0) NOT NULL DEFAULT 0,
  "points" int NOT NULL DEFAULT 0
  -- PRIMARY KEY("product_points_id")
);

SELECT setval('product_points_product_points_id_seq', 11, true); -- last inserted id by sample data
