pgsql 常用的建表語句


DROP TABLE IF EXISTS "public"."xxxxxx";
DROP SEQUENCE IF EXISTS "public"."xxxxxx_id_seq";
CREATE SEQUENCE "public"."xxxxxx_id_seq"
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;



CREATE TABLE "public"."xxxxxx" (
  "id" int4 NOT NULL DEFAULT nextval('xxxxxx_id_seq'::regclass),
  "main_id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "telephone" varchar(20),
  "send_message" int4,
  "times" int4,
  "type" int4,
  "create_time" timestamp(0),
  "update_time" timestamp(0)
)
;
COMMENT ON COLUMN "public"."xxxxxx"."telephone" IS '手機號碼';
COMMENT ON COLUMN "public"."xxxxxx"."send_message" IS '是否需要發送短信';
COMMENT ON COLUMN "public"."xxxxxx"."times" IS '短信發送次數';
COMMENT ON COLUMN "public"."xxxxxx"."type" IS '發送短信類型';


CREATE INDEX "index_xxxxxx_main_id" ON "public"."xxxxxx" USING btree (
  "main_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);


GRANT Delete, Insert, Select, Truncate, Update ON TABLE "public"."xxxxxx" TO "user";
GRANT Update,Select ON TABLE "public"."xxxxxx_id_seq" TO "user";




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM