Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

759 B
Raw Blame
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")
);

CREATE INDEX "user_points_user_id" ON user_points ("user_id");
CREATE INDEX "user_points_order_id" ON user_points ("order_id");

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