-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathbtw.sql
101 lines (86 loc) · 2.52 KB
/
btw.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-- -------------------------------------------------------------
-- Database: btw
-- Generation Time: 2023-06-04 14:36:11.7610
-- -------------------------------------------------------------
CREATE SCHEMA IF NOT EXISTS btw;
DROP TABLE IF EXISTS "btw"."custom_domains";
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS btw.custom_domains_id_seq;
-- Table Definition
CREATE TABLE "btw"."custom_domains" (
"id" int4 NOT NULL DEFAULT nextval('btw.custom_domains_id_seq'::regclass),
"domain" text NOT NULL,
"user_id" int4 NOT NULL,
"umami_site_id" uuid,
"share_id" text,
PRIMARY KEY ("domain","user_id")
);
DROP TABLE IF EXISTS "btw"."login_token";
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS btw.login_token_id_seq;
-- Table Definition
CREATE TABLE "btw"."login_token" (
"id" int4 NOT NULL DEFAULT nextval('btw.login_token_id_seq'::regclass),
"uuid" uuid NOT NULL,
"user_id" int4 NOT NULL,
"created_at" timestamptz NOT NULL,
"ip_address" text NOT NULL,
"fingerprint" text NOT NULL,
PRIMARY KEY ("uuid")
);
DROP TABLE IF EXISTS "btw"."notes";
-- Table Definition
CREATE TABLE "btw"."notes" (
"user_id" int4 NOT NULL,
"created_at" timestamptz NOT NULL,
"updated_at" timestamptz NOT NULL,
"json" json,
"html" text,
"title" text,
"id" uuid NOT NULL,
"ydoc" bytea,
"tags" text,
"published_at" timestamptz,
"slug" text,
"publish" bool,
"archive" bool,
"delete" bool,
"deleted_at" timestamptz,
"md" text,
"image" text,
PRIMARY KEY ("id","user_id")
);
DROP TABLE IF EXISTS "btw"."otp";
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS btw.otp_id_seq;
-- Table Definition
CREATE TABLE "btw"."otp" (
"id" int4 NOT NULL DEFAULT nextval('btw.otp_id_seq'::regclass),
"created_at" timestamptz NOT NULL,
"email" text NOT NULL,
"processed_email" text NOT NULL,
"otp" text NOT NULL,
PRIMARY KEY ("id")
);
DROP TABLE IF EXISTS "btw"."users";
-- Sequence and defined type
CREATE SEQUENCE IF NOT EXISTS btw.user_id_seq;
-- Table Definition
CREATE TABLE "btw"."users" (
"id" int4 NOT NULL DEFAULT nextval('btw.user_id_seq'::regclass),
"email" text NOT NULL,
"processed_email" text NOT NULL,
"name" text,
"slug" text,
"created_at" timestamptz NOT NULL,
"bio" text,
"pic" varchar,
"twitter" varchar,
"instagram" varchar,
"linkedin" varchar,
"pro" bool,
"umami_site_id" uuid,
"share_id" text,
"settings" json,
PRIMARY KEY ("processed_email")
);