postgresql建表带自增id和注释语句
2020-12-10 本文已影响0人
wandx
work是表名,nextval('work_myid_seq'::regclass)这个是自增id的设置
CREATE TABLE "public"."work" (
"id" int8 NOT NULL DEFAULT nextval('work_myid_seq'::regclass),
"wid" int8,
"address" varchar(100) COLLATE "pg_catalog"."default",
"reportyear" varchar(10) COLLATE "pg_catalog"."default",
"reportmonth" varchar(10) COLLATE "pg_catalog"."default",
"userid" int8,
"adcode" varchar(50) COLLATE "pg_catalog"."default",
"latitude" varchar(50) COLLATE "pg_catalog"."default",
"longitude" varchar(50) COLLATE "pg_catalog"."default",
"riverId" int8,
"name" varchar(255) COLLATE "pg_catalog"."default",
"isreport" int2,
"createtime" date,
"updatetime" timestamp(6),
"accessory" varchar(255) COLLATE "pg_catalog"."default",
"remark" text COLLATE "pg_catalog"."default",
CONSTRAINT "work_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."work"
OWNER TO "postgres";
COMMENT ON COLUMN "public"."work"."id" IS 'Id(主键)';
COMMENT ON COLUMN "public"."work"."wid" IS '工作进度id';
COMMENT ON COLUMN "public"."work"."address" IS '公示牌地址';
COMMENT ON COLUMN "public"."work"."reportyear" IS '填报年份';
COMMENT ON COLUMN "public"."work"."reportmonth" IS '填报月份';
COMMENT ON COLUMN "public"."work"."userid" IS '创建人 id';
COMMENT ON COLUMN "public"."work"."adcode" IS '行政区划编码';
COMMENT ON COLUMN "public"."work"."latitude" IS '纬度';
COMMENT ON COLUMN "public"."work"."longitude" IS '经度';
COMMENT ON COLUMN "public"."work"."riverId" IS '河段 id';
COMMENT ON COLUMN "public"."work"."name" IS '公示牌名称';
COMMENT ON COLUMN "public"."work"."isreport" IS '是否上报(0:未上报 1:已上报)';
COMMENT ON COLUMN "public"."work"."createtime" IS '创建时间';
COMMENT ON COLUMN "public"."work"."updatetime" IS '更新时间';
COMMENT ON COLUMN "public"."work"."accessory" IS '附件';
COMMENT ON COLUMN "public"."work"."remark" IS '备注';
COMMENT ON TABLE "public"."work" IS '公示牌设立信息';