
CREATE TABLE "public"."app_category" (
      "id" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "type" varchar(32),
      "name" varchar(64),
      "desc" text,
      "create_time" time,
      "update_time" time,
      PRIMARY KEY ("id")
);

COMMENT ON COLUMN "public"."app_category"."type" IS '用户标签类型,user_pay等';

COMMENT ON COLUMN "public"."app_category"."name" IS '用户标签名字';

COMMENT ON COLUMN "public"."app_category"."desc" IS '用户标签描述';

CREATE TABLE "public"."app_user_category" (
     "id" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
     "user_id" int4 NOT NULL,
     "cat_id" int4 NOT NULL,
     "create_time" time,
     PRIMARY KEY ("id")
);

CREATE INDEX "u-c-uid-cid" ON "public"."app_user_category" USING btree (
  "user_id",
  "cat_id"
);

COMMENT ON COLUMN "public"."app_user_category"."user_id" IS 'app用户id';

COMMENT ON COLUMN "public"."app_user_category"."cat_id" IS '用户关联分类id';


CREATE TABLE "public"."app_category_payment" (
      "id" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "cat_id" int4 NOT NULL,
      "ref_pay_id" int4 NOT NULL,
      "weight_num" varchar(32),
      "status" int2 default 0,
      "create_time" time,
      PRIMARY KEY ("id")
);

CREATE INDEX "u-c-p-pid-cid" ON "public"."app_category_payment" USING btree (
  "ref_pay_id",
  "cat_id",
  "status"
);


COMMENT ON COLUMN "public"."app_category_payment"."weight_num" IS '分类支付权重值,';

COMMENT ON COLUMN "public"."app_category_payment"."status" IS '默认0:不生效,1:生效';



