-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.sql
More file actions
82 lines (81 loc) · 1.76 KB
/
db.sql
File metadata and controls
82 lines (81 loc) · 1.76 KB
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
CREATE TABLE "reset_codes" (
"code" TEXT NOT NULL,
"user_id" INTEGER NOT NULL,
"expires_at" TEXT NOT NULL,
PRIMARY KEY("code")
);
CREATE TABLE "tokens" (
"token" TEXT NOT NULL,
"user_id" INTEGER NOT NULL,
"expires_at" TEXT NOT NULL,
PRIMARY KEY("token")
);
CREATE INDEX "reset_codes-created_at" ON "reset_codes" (
"expires_at" DESC
);
CREATE INDEX "reset_codes-user_id" ON "reset_codes" (
"user_id"
);
CREATE INDEX "tokens-expires_at" ON "tokens" (
"expires_at" DESC
);
CREATE INDEX "tokens-user_id" ON "tokens" (
"user_id"
);
CREATE TABLE "users" (
"id" INTEGER,
"email" TEXT NOT NULL UNIQUE,
"password" TEXT NOT NULL,
"type" TEXT NOT NULL DEFAULT 'customer',
"created_at" TEXT NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE INDEX "users-created_at" ON "users" (
"created_at" DESC
);
CREATE INDEX "users-type" ON "users" (
"type" ASC
);
CREATE TABLE "products" (
"id" INTEGER,
"name" TEXT NOT NULL UNIQUE,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE "plugins" (
"name" TEXT NOT NULL,
"active" TEXT NOT NULL DEFAULT 'false',
PRIMARY KEY("name")
);
CREATE INDEX "plugins-active" ON "plugins" (
"active" ASC
);
CREATE TABLE "tags" (
"for_table" TEXT NOT NULL,
"for_id" INTEGER NOT NULL,
"key" TEXT NOT NULL,
"language" TEXT NOT NULL DEFAULT 'en',
"value" TEXT NOT NULL,
PRIMARY KEY("for_table","for_id","key","language")
);
CREATE INDEX "tags-table_id_key_language" ON "tags" (
"for_table" ASC,
"for_id" DESC,
"key" ASC,
"language" ASC
);
CREATE INDEX "tags-table_id_language" ON "tags" (
"for_table" ASC,
"for_id" DESC,
"language" ASC
);
CREATE INDEX "tags-value" ON "tags" (
"value" ASC
);
CREATE TABLE "tag_keys" (
"key" TEXT,
"one_per" TEXT NOT NULL DEFAULT 'false',
PRIMARY KEY("key")
);
CREATE INDEX "teg_keys-key" ON "tag_keys" (
"key"
);