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