CREATE TABLE "app_user_browse_record" (
                                          "id" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
                                          "type" varchar(255),
                                          "item_id" int8,
                                          "user_id" int8,
                                          "browse_time" timestamp,
                                          "browse_date" date,
                                          "source_type" varchar(255),
                                          "extra_info" varchar(255),
                                          "merchant_id" int8,
                                          "create_time" timestamp,
                                          PRIMARY KEY ("id")
);

CREATE INDEX idx_user_browse_user_id ON app_user_browse_record (user_id);
CREATE UNIQUE INDEX unique_user_item_type ON app_user_browse_record (user_id, item_id, type);

COMMENT ON COLUMN "app_user_browse_record"."type" IS '类型: group 拼团、goods 商品、shop 店铺';
COMMENT ON COLUMN "app_user_browse_record"."item_id" IS '拼团/商品/店铺id';
COMMENT ON COLUMN "app_user_browse_record"."user_id" IS '用户id';
COMMENT ON COLUMN "app_user_browse_record"."browse_time" IS '浏览时间';
COMMENT ON COLUMN "app_user_browse_record"."browse_date" IS '浏览日期';
COMMENT ON COLUMN "app_user_browse_record"."source_type" IS '浏览来源';
COMMENT ON COLUMN "app_user_browse_record"."merchant_id" IS '商家id';
COMMENT ON COLUMN "app_user_browse_record"."extra_info" IS '扩展字段';





