/*
 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");
