PostgreSQL 创建主键自增表的 DDL
-- 社区表 DROP TABLE IF EXISTS public.t_community; CREATE TABLE public.t_community ( id bigserial NOT NULL, grid_id int8 NULL, name varchar(128) NOT NULL, description varchar(4096) NULL, create_time timestamp DEFAULT CURRENT_TIMESTAMP NULL, update_time timestamp NULL, remark varchar(4096) NULL, removed bool DEFAULT false NULL, version int4 DEFAULT 1 NULL, CONSTRAINT t_community_primary_key PRIMARY KEY (id) ); COMMENT ON TABLE t_community IS '社区表'; COMMENT ON COLUMN t_community.id IS '唯一标识,通过序列自增。'; COMMENT ON COLUMN t_community.grid_id IS '网格的唯一标识'; COMMENT ON COLUMN t_community.name IS '名称'; COMMENT ON COLUMN t_community.description IS '描述'; COMMENT ON COLUMN t_community.create_time IS '创建时间,一旦创建则不可再改变'; COMMENT ON COLUMN t_community.update_time IS '更新时间,只要有数据变动此值就会改变。'; COMMENT ON COLUMN t_community.remark IS '备注'; COMMENT ON COLUMN t_community.removed IS '是否已移除:假是未移除,真是已移除。'; COMMENT ON COLUMN t_community.version IS '版本号';
标签:COMMENT,PostgreSQL,COLUMN,自增表,community,id,time,NULL,主键 From: https://www.cnblogs.com/hapday/p/18450122