DROP TABLE IF EXISTS user_points;

-- DROP SEQUENCE IF EXISTS user_points_user_points_id_seq;
-- CREATE SEQUENCE user_points_user_points_id_seq;


CREATE TABLE user_points (
  "user_points_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "user_id" int check ("user_id" > 0) NOT NULL DEFAULT 0,
  "order_id" int check ("order_id" > 0) NOT NULL DEFAULT 0,
  "content" text NOT NULL,
  "points" int NOT NULL DEFAULT 0,
  "created_at" timestamp(0) NOT NULL DEFAULT now()
  -- PRIMARY KEY("user_points_id")
);


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