From 9664adafafff238e843c6dbe6f65721f9992aaf4 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 20 Jun 2022 11:07:12 +0800 Subject: [PATCH] =?UTF-8?q?sql=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/script/0.0.1/0_init_db.sql | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 doc/script/0.0.1/0_init_db.sql diff --git a/doc/script/0.0.1/0_init_db.sql b/doc/script/0.0.1/0_init_db.sql new file mode 100644 index 0000000..49e81c4 --- /dev/null +++ b/doc/script/0.0.1/0_init_db.sql @@ -0,0 +1,86 @@ +/* + Navicat Premium Data Transfer + + Source Server : 10.8.30.32 + Source Server Type : PostgreSQL + Source Server Version : 90515 + Source Host : 10.8.30.32:5432 + Source Catalog : iot_auth + Source Schema : public + + Target Server Type : PostgreSQL + Target Server Version : 90515 + File Encoding : 65001 + + Date: 20/06/2022 10:54:36 +*/ + + +-- ---------------------------- +-- Sequence structure for user_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."user_id_seq"; +CREATE SEQUENCE "public"."user_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Table structure for user +-- ---------------------------- +DROP TABLE IF EXISTS "public"."user"; +CREATE TABLE "public"."user" ( + "id" int4 NOT NULL DEFAULT nextval('user_id_seq'::regclass), + "name" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, + "name_present" varchar(64) COLLATE "pg_catalog"."default", + "password" varchar(64) COLLATE "pg_catalog"."default", + "phone" varchar(64) COLLATE "pg_catalog"."default", + "email" varchar(64) COLLATE "pg_catalog"."default", + "enabled" bool DEFAULT true, + "delete" bool NOT NULL DEFAULT false +) +; + +-- ---------------------------- +-- Table structure for user_token +-- ---------------------------- +DROP TABLE IF EXISTS "public"."user_token"; +CREATE TABLE "public"."user_token" ( + "token" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, + "user_info" jsonb NOT NULL, + "expired" timestamptz(6) NOT NULL +) +; + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."user_id_seq" +OWNED BY "public"."user"."id"; +SELECT setval('"public"."user_id_seq"', 52, true); + +-- ---------------------------- +-- Indexes structure for table user +-- ---------------------------- +CREATE UNIQUE INDEX "user_id_uindex" ON "public"."user" USING btree ( + "id" "pg_catalog"."int4_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Primary Key structure for table user +-- ---------------------------- +ALTER TABLE "public"."user" ADD CONSTRAINT "user_pk" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table user_token +-- ---------------------------- +CREATE UNIQUE INDEX "user_token_token_uindex" ON "public"."user_token" USING btree ( + "token" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Primary Key structure for table user_token +-- ---------------------------- +ALTER TABLE "public"."user_token" ADD CONSTRAINT "user_token_pk" PRIMARY KEY ("token");