1、创建表
CREATE TABLE "public"."admin_user" ( "id" int4, "username" text COLLATE "default", "password" text COLLATE "default", "add_time" int4, "update_time" int4, "status" int4, CONSTRAINT "admin_user_pkey" PRIMARY KEY ("id") ) WITH (OIDS=FALSE); ALTER TABLE "public"."admin_user" OWNER TO "postgres";
2、创建序列
CREATE SEQUENCE public.admin_user_id_seq INCREMENT 1 START 1 NO MINVALUE NO MAXVALUE CACHE 1;
3、设置字段自增
alter table "public"."admin_user" alter column id set default nextval('admin_user_id_seq');
4、更新序列
ALTER SEQUENCE public.admin_user_id_seq INCREMENT 10 NO MINVALUE NO MAXVALUE CACHE 1;
5、删除序列
alter table "public"."admin_user" alter column id set default 0; DROP SEQUENCE public.admin_user_id_seq;