@ooneex/typeorm 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/chunk-0swb1h0m.js +51 -0
- package/dist/shared/{chunk-xwe8m6av.js.map → chunk-0swb1h0m.js.map} +2 -2
- package/dist/shared/chunk-2wdazj26.js +371 -0
- package/dist/shared/{chunk-5tnqjb3n.js.map → chunk-2wdazj26.js.map} +2 -2
- package/dist/shared/chunk-6m3p1ht9.js +606 -0
- package/dist/shared/{chunk-yrwsqc6r.js.map → chunk-6m3p1ht9.js.map} +2 -2
- package/dist/shared/{chunk-qrs0g3m9.js → chunk-6vmvyg0q.js} +58 -17
- package/dist/shared/{chunk-qrs0g3m9.js.map → chunk-6vmvyg0q.js.map} +2 -2
- package/dist/shared/chunk-bkdccdhn.js +105 -0
- package/dist/shared/{chunk-p22keb3y.js.map → chunk-bkdccdhn.js.map} +2 -2
- package/dist/shared/chunk-chan1evn.js +72 -0
- package/dist/shared/{chunk-xrqhqgen.js.map → chunk-chan1evn.js.map} +2 -2
- package/dist/shared/chunk-cv6xa6qy.js +621 -0
- package/dist/shared/{chunk-t1jad451.js.map → chunk-cv6xa6qy.js.map} +2 -2
- package/dist/shared/chunk-cwxhwya1.js +548 -0
- package/dist/shared/{chunk-x3pmm3na.js.map → chunk-cwxhwya1.js.map} +2 -2
- package/dist/shared/{chunk-qyf32qsz.js → chunk-eets3mef.js} +75 -22
- package/dist/shared/{chunk-qyf32qsz.js.map → chunk-eets3mef.js.map} +2 -2
- package/dist/shared/chunk-efmap3y3.js +345 -0
- package/dist/shared/{chunk-e51ktjsq.js.map → chunk-efmap3y3.js.map} +2 -2
- package/dist/shared/chunk-hkfj9j6w.js +30 -0
- package/dist/shared/{chunk-pbns711f.js.map → chunk-hkfj9j6w.js.map} +2 -2
- package/dist/shared/{chunk-aj0aak90.js → chunk-jap9t59k.js} +52 -14
- package/dist/shared/{chunk-aj0aak90.js.map → chunk-jap9t59k.js.map} +2 -2
- package/dist/shared/chunk-m4mpkr4n.js +34 -0
- package/dist/shared/{chunk-5ybg5hda.js.map → chunk-m4mpkr4n.js.map} +2 -2
- package/dist/shared/chunk-m9wkjs7v.js +639 -0
- package/dist/shared/{chunk-kw4t1san.js.map → chunk-m9wkjs7v.js.map} +2 -2
- package/dist/shared/chunk-mssxq87m.js +195 -0
- package/dist/shared/{chunk-6kdkyjbn.js.map → chunk-mssxq87m.js.map} +2 -2
- package/dist/shared/chunk-p12g6e7b.js +38 -0
- package/dist/shared/{chunk-6jnj2pfx.js.map → chunk-p12g6e7b.js.map} +2 -2
- package/dist/shared/chunk-qbn9p4vj.js +835 -0
- package/dist/shared/{chunk-nfv9ce7v.js.map → chunk-qbn9p4vj.js.map} +2 -2
- package/dist/shared/chunk-r9hsk9fk.js +20 -0
- package/dist/shared/{chunk-59vwmfpm.js.map → chunk-r9hsk9fk.js.map} +1 -1
- package/dist/shared/chunk-sk8z5zmk.js +112 -0
- package/dist/shared/{chunk-x2d798hg.js.map → chunk-sk8z5zmk.js.map} +2 -2
- package/dist/shared/chunk-tqd6ek7s.js +86 -0
- package/dist/shared/{chunk-19qhst35.js.map → chunk-tqd6ek7s.js.map} +2 -2
- package/dist/shared/{chunk-31y260d6.js → chunk-trhrh4e1.js} +89 -24
- package/dist/shared/{chunk-31y260d6.js.map → chunk-trhrh4e1.js.map} +2 -2
- package/dist/shared/chunk-wg7xcq50.js +38 -0
- package/dist/shared/{chunk-t5cy307m.js.map → chunk-wg7xcq50.js.map} +2 -2
- package/dist/shared/{chunk-jr0xys18.js → chunk-yszvxhf3.js} +41 -11
- package/dist/shared/{chunk-jr0xys18.js.map → chunk-yszvxhf3.js.map} +2 -2
- package/dist/src/entities/book/index.js +34 -2
- package/dist/src/entities/book/index.js.map +1 -1
- package/dist/src/entities/common/index.js +26 -2
- package/dist/src/entities/common/index.js.map +1 -1
- package/dist/src/entities/country/index.js +9 -2
- package/dist/src/entities/country/index.js.map +1 -1
- package/dist/src/entities/currency/index.js +9 -2
- package/dist/src/entities/currency/index.js.map +1 -1
- package/dist/src/entities/folder/index.js +394 -2
- package/dist/src/entities/folder/index.js.map +2 -2
- package/dist/src/entities/gamification/flashcard/index.js +26 -2
- package/dist/src/entities/gamification/flashcard/index.js.map +1 -1
- package/dist/src/entities/gamification/index.js +9 -2
- package/dist/src/entities/gamification/index.js.map +1 -1
- package/dist/src/entities/gamification/mcq/index.js +36 -2
- package/dist/src/entities/gamification/mcq/index.js.map +1 -1
- package/dist/src/entities/image/index.js +31 -2
- package/dist/src/entities/image/index.js.map +1 -1
- package/dist/src/entities/medecine/index.js +13 -2
- package/dist/src/entities/medecine/index.js.map +1 -1
- package/dist/src/entities/payment/index.js +23 -2
- package/dist/src/entities/payment/index.js.map +1 -1
- package/dist/src/entities/user/index.js +30 -2
- package/dist/src/entities/user/index.js.map +1 -1
- package/dist/src/entities/video/index.js +34 -2
- package/dist/src/entities/video/index.js.map +1 -1
- package/dist/src/migrations/book/index.js +541 -137
- package/dist/src/migrations/book/index.js.map +2 -2
- package/dist/src/migrations/common/index.js +63 -14
- package/dist/src/migrations/common/index.js.map +2 -2
- package/dist/src/migrations/country/index.js +48 -13
- package/dist/src/migrations/country/index.js.map +2 -2
- package/dist/src/migrations/currency/index.js +50 -14
- package/dist/src/migrations/currency/index.js.map +2 -2
- package/dist/src/migrations/folder/index.js +426 -104
- package/dist/src/migrations/folder/index.js.map +2 -2
- package/dist/src/migrations/gamification/flashcard/index.js +356 -96
- package/dist/src/migrations/gamification/flashcard/index.js.map +2 -2
- package/dist/src/migrations/gamification/index.js +8 -2
- package/dist/src/migrations/gamification/index.js.map +1 -1
- package/dist/src/migrations/gamification/mcq/index.js +553 -139
- package/dist/src/migrations/gamification/mcq/index.js.map +2 -2
- package/dist/src/migrations/image/index.js +353 -85
- package/dist/src/migrations/image/index.js.map +2 -2
- package/dist/src/migrations/medecine/index.js +132 -36
- package/dist/src/migrations/medecine/index.js.map +2 -2
- package/dist/src/migrations/payment/index.js +339 -94
- package/dist/src/migrations/payment/index.js.map +2 -2
- package/dist/src/migrations/user/index.js +331 -39
- package/dist/src/migrations/user/index.js.map +2 -2
- package/dist/src/migrations/video/index.js +345 -17
- package/dist/src/migrations/video/index.js.map +2 -2
- package/dist/src/repositories/book/index.js +997 -2
- package/dist/src/repositories/book/index.js.map +2 -2
- package/dist/src/repositories/common/index.js +439 -2
- package/dist/src/repositories/common/index.js.map +2 -2
- package/dist/src/repositories/country/index.js +89 -2
- package/dist/src/repositories/country/index.js.map +2 -2
- package/dist/src/repositories/currency/index.js +89 -2
- package/dist/src/repositories/currency/index.js.map +2 -2
- package/dist/src/repositories/gamification/flashcard/index.js +632 -2
- package/dist/src/repositories/gamification/flashcard/index.js.map +2 -2
- package/dist/src/repositories/gamification/index.js +160 -2
- package/dist/src/repositories/gamification/index.js.map +2 -2
- package/dist/src/repositories/gamification/mcq/index.js +1017 -2
- package/dist/src/repositories/gamification/mcq/index.js.map +2 -2
- package/dist/src/repositories/image/index.js +800 -2
- package/dist/src/repositories/image/index.js.map +2 -2
- package/dist/src/repositories/medecine/index.js +243 -2
- package/dist/src/repositories/medecine/index.js.map +2 -2
- package/dist/src/repositories/payment/index.js +560 -2
- package/dist/src/repositories/payment/index.js.map +2 -2
- package/dist/src/repositories/user/index.js +999 -2
- package/dist/src/repositories/user/index.js.map +2 -2
- package/dist/src/repositories/video/index.js +975 -2
- package/dist/src/repositories/video/index.js.map +2 -2
- package/package.json +21 -21
- package/dist/shared/chunk-19qhst35.js +0 -5
- package/dist/shared/chunk-59vwmfpm.js +0 -5
- package/dist/shared/chunk-5tnqjb3n.js +0 -5
- package/dist/shared/chunk-5ybg5hda.js +0 -5
- package/dist/shared/chunk-6jnj2pfx.js +0 -5
- package/dist/shared/chunk-6kdkyjbn.js +0 -5
- package/dist/shared/chunk-e51ktjsq.js +0 -5
- package/dist/shared/chunk-kw4t1san.js +0 -5
- package/dist/shared/chunk-nfv9ce7v.js +0 -5
- package/dist/shared/chunk-p22keb3y.js +0 -5
- package/dist/shared/chunk-pbns711f.js +0 -5
- package/dist/shared/chunk-t1jad451.js +0 -5
- package/dist/shared/chunk-t5cy307m.js +0 -5
- package/dist/shared/chunk-x2d798hg.js +0 -5
- package/dist/shared/chunk-x3pmm3na.js +0 -5
- package/dist/shared/chunk-xrqhqgen.js +0 -5
- package/dist/shared/chunk-xwe8m6av.js +0 -5
- package/dist/shared/chunk-yrwsqc6r.js +0 -5
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
Migration20251225173352645
|
|
4
|
+
} from "../../../shared/chunk-6vmvyg0q.js";
|
|
5
|
+
import {
|
|
6
|
+
Migration20251225173351645
|
|
7
|
+
} from "../../../shared/chunk-jap9t59k.js";
|
|
8
|
+
import {
|
|
9
|
+
Migration20251225173350644
|
|
10
|
+
} from "../../../shared/chunk-trhrh4e1.js";
|
|
11
|
+
import {
|
|
12
|
+
__legacyDecorateClassTS
|
|
13
|
+
} from "../../../shared/chunk-r9hsk9fk.js";
|
|
14
|
+
|
|
15
|
+
// src/migrations/book/Migration20251225173353646.ts
|
|
16
|
+
import { decorator } from "@ooneex/migrations";
|
|
17
|
+
class Migration20251225173353646 {
|
|
18
|
+
async up(tx) {
|
|
19
|
+
await tx`
|
|
3
20
|
CREATE TABLE IF NOT EXISTS book_authors (
|
|
4
21
|
id VARCHAR(25) PRIMARY KEY,
|
|
5
22
|
first_name VARCHAR(100) NOT NULL,
|
|
@@ -20,27 +37,56 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
20
37
|
updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
|
21
38
|
deleted_at TIMESTAMPTZ
|
|
22
39
|
)
|
|
23
|
-
|
|
40
|
+
`;
|
|
41
|
+
await tx`
|
|
24
42
|
CREATE INDEX IF NOT EXISTS idx_book_authors_first_name ON book_authors(first_name)
|
|
25
|
-
|
|
43
|
+
`;
|
|
44
|
+
await tx`
|
|
26
45
|
CREATE INDEX IF NOT EXISTS idx_book_authors_last_name ON book_authors(last_name)
|
|
27
|
-
|
|
46
|
+
`;
|
|
47
|
+
await tx`
|
|
28
48
|
CREATE INDEX IF NOT EXISTS idx_book_authors_full_name ON book_authors(full_name)
|
|
29
|
-
|
|
49
|
+
`;
|
|
50
|
+
await tx`
|
|
30
51
|
CREATE INDEX IF NOT EXISTS idx_book_authors_nationality ON book_authors(nationality)
|
|
31
|
-
|
|
52
|
+
`;
|
|
53
|
+
await tx`
|
|
32
54
|
CREATE INDEX IF NOT EXISTS idx_book_authors_language ON book_authors(language)
|
|
33
|
-
|
|
55
|
+
`;
|
|
56
|
+
await tx`
|
|
34
57
|
CREATE INDEX IF NOT EXISTS idx_book_authors_deleted_at ON book_authors(deleted_at)
|
|
35
|
-
|
|
58
|
+
`;
|
|
59
|
+
await tx`
|
|
36
60
|
CREATE INDEX IF NOT EXISTS idx_book_authors_is_public ON book_authors(is_public) WHERE deleted_at IS NULL
|
|
37
|
-
|
|
61
|
+
`;
|
|
62
|
+
await tx`
|
|
38
63
|
CREATE INDEX IF NOT EXISTS idx_book_authors_full_name_lower ON book_authors(LOWER(full_name)) WHERE deleted_at IS NULL
|
|
39
|
-
|
|
64
|
+
`;
|
|
65
|
+
await tx`
|
|
40
66
|
CREATE INDEX IF NOT EXISTS idx_book_authors_created_at ON book_authors(created_at DESC)
|
|
41
|
-
|
|
67
|
+
`;
|
|
68
|
+
await tx`
|
|
42
69
|
CREATE INDEX IF NOT EXISTS idx_book_authors_active ON book_authors(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
43
|
-
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
async down(tx) {
|
|
73
|
+
await tx`DROP TABLE IF EXISTS book_authors CASCADE`;
|
|
74
|
+
}
|
|
75
|
+
getVersion() {
|
|
76
|
+
return "20251225173353646";
|
|
77
|
+
}
|
|
78
|
+
getDependencies() {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Migration20251225173353646 = __legacyDecorateClassTS([
|
|
83
|
+
decorator.migration()
|
|
84
|
+
], Migration20251225173353646);
|
|
85
|
+
// src/migrations/book/Migration20251225173354646.ts
|
|
86
|
+
import { decorator as decorator2 } from "@ooneex/migrations";
|
|
87
|
+
class Migration20251225173354646 {
|
|
88
|
+
async up(tx) {
|
|
89
|
+
await tx`
|
|
44
90
|
CREATE TABLE IF NOT EXISTS book_publishers (
|
|
45
91
|
id VARCHAR(25) PRIMARY KEY,
|
|
46
92
|
name VARCHAR(200) NOT NULL,
|
|
@@ -58,23 +104,50 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
58
104
|
updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
|
59
105
|
deleted_at TIMESTAMPTZ
|
|
60
106
|
)
|
|
61
|
-
|
|
107
|
+
`;
|
|
108
|
+
await tx`
|
|
62
109
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_name ON book_publishers(name)
|
|
63
|
-
|
|
110
|
+
`;
|
|
111
|
+
await tx`
|
|
64
112
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_founded_year ON book_publishers(founded_year)
|
|
65
|
-
|
|
113
|
+
`;
|
|
114
|
+
await tx`
|
|
66
115
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_language ON book_publishers(language)
|
|
67
|
-
|
|
116
|
+
`;
|
|
117
|
+
await tx`
|
|
68
118
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_deleted_at ON book_publishers(deleted_at)
|
|
69
|
-
|
|
119
|
+
`;
|
|
120
|
+
await tx`
|
|
70
121
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_is_public ON book_publishers(is_public) WHERE deleted_at IS NULL
|
|
71
|
-
|
|
122
|
+
`;
|
|
123
|
+
await tx`
|
|
72
124
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_name_lower ON book_publishers(LOWER(name)) WHERE deleted_at IS NULL
|
|
73
|
-
|
|
125
|
+
`;
|
|
126
|
+
await tx`
|
|
74
127
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_created_at ON book_publishers(created_at DESC)
|
|
75
|
-
|
|
128
|
+
`;
|
|
129
|
+
await tx`
|
|
76
130
|
CREATE INDEX IF NOT EXISTS idx_book_publishers_active ON book_publishers(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
77
|
-
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
async down(tx) {
|
|
134
|
+
await tx`DROP TABLE IF EXISTS book_publishers CASCADE`;
|
|
135
|
+
}
|
|
136
|
+
getVersion() {
|
|
137
|
+
return "20251225173354646";
|
|
138
|
+
}
|
|
139
|
+
getDependencies() {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
Migration20251225173354646 = __legacyDecorateClassTS([
|
|
144
|
+
decorator2.migration()
|
|
145
|
+
], Migration20251225173354646);
|
|
146
|
+
// src/migrations/book/Migration20251225173355647.ts
|
|
147
|
+
import { decorator as decorator3 } from "@ooneex/migrations";
|
|
148
|
+
class Migration20251225173355647 {
|
|
149
|
+
async up(tx) {
|
|
150
|
+
await tx`
|
|
78
151
|
CREATE TABLE IF NOT EXISTS books (
|
|
79
152
|
id VARCHAR(25) PRIMARY KEY,
|
|
80
153
|
title VARCHAR(500) NOT NULL,
|
|
@@ -112,7 +185,8 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
112
185
|
CONSTRAINT fk_books_category FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE SET NULL,
|
|
113
186
|
CONSTRAINT fk_books_status FOREIGN KEY (status_id) REFERENCES statuses(id) ON DELETE SET NULL
|
|
114
187
|
)
|
|
115
|
-
|
|
188
|
+
`;
|
|
189
|
+
await tx`
|
|
116
190
|
CREATE TABLE IF NOT EXISTS books_authors (
|
|
117
191
|
book_id VARCHAR(25) NOT NULL,
|
|
118
192
|
author_id VARCHAR(25) NOT NULL,
|
|
@@ -120,7 +194,8 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
120
194
|
CONSTRAINT fk_books_authors_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
|
|
121
195
|
CONSTRAINT fk_books_authors_author FOREIGN KEY (author_id) REFERENCES book_authors(id) ON DELETE CASCADE
|
|
122
196
|
)
|
|
123
|
-
|
|
197
|
+
`;
|
|
198
|
+
await tx`
|
|
124
199
|
CREATE TABLE IF NOT EXISTS books_tags (
|
|
125
200
|
book_id VARCHAR(25) NOT NULL,
|
|
126
201
|
tag_id VARCHAR(25) NOT NULL,
|
|
@@ -128,53 +203,103 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
128
203
|
CONSTRAINT fk_books_tags_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
|
|
129
204
|
CONSTRAINT fk_books_tags_tag FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE
|
|
130
205
|
)
|
|
131
|
-
|
|
206
|
+
`;
|
|
207
|
+
await tx`
|
|
132
208
|
CREATE INDEX IF NOT EXISTS idx_books_title ON books(title)
|
|
133
|
-
|
|
209
|
+
`;
|
|
210
|
+
await tx`
|
|
134
211
|
CREATE INDEX IF NOT EXISTS idx_books_isbn ON books(isbn)
|
|
135
|
-
|
|
212
|
+
`;
|
|
213
|
+
await tx`
|
|
136
214
|
CREATE INDEX IF NOT EXISTS idx_books_isbn13 ON books(isbn13)
|
|
137
|
-
|
|
215
|
+
`;
|
|
216
|
+
await tx`
|
|
138
217
|
CREATE INDEX IF NOT EXISTS idx_books_publisher_id ON books(publisher_id)
|
|
139
|
-
|
|
218
|
+
`;
|
|
219
|
+
await tx`
|
|
140
220
|
CREATE INDEX IF NOT EXISTS idx_books_category_id ON books(category_id)
|
|
141
|
-
|
|
221
|
+
`;
|
|
222
|
+
await tx`
|
|
142
223
|
CREATE INDEX IF NOT EXISTS idx_books_status_id ON books(status_id)
|
|
143
|
-
|
|
224
|
+
`;
|
|
225
|
+
await tx`
|
|
144
226
|
CREATE INDEX IF NOT EXISTS idx_books_language ON books(language)
|
|
145
|
-
|
|
227
|
+
`;
|
|
228
|
+
await tx`
|
|
146
229
|
CREATE INDEX IF NOT EXISTS idx_books_deleted_at ON books(deleted_at)
|
|
147
|
-
|
|
230
|
+
`;
|
|
231
|
+
await tx`
|
|
148
232
|
CREATE INDEX IF NOT EXISTS idx_books_context ON books(context, context_id)
|
|
149
|
-
|
|
233
|
+
`;
|
|
234
|
+
await tx`
|
|
150
235
|
CREATE INDEX IF NOT EXISTS idx_books_series ON books(series, series_volume)
|
|
151
|
-
|
|
236
|
+
`;
|
|
237
|
+
await tx`
|
|
152
238
|
CREATE INDEX IF NOT EXISTS idx_books_published_date ON books(published_date DESC)
|
|
153
|
-
|
|
239
|
+
`;
|
|
240
|
+
await tx`
|
|
154
241
|
CREATE INDEX IF NOT EXISTS idx_books_average_rating ON books(average_rating DESC)
|
|
155
|
-
|
|
242
|
+
`;
|
|
243
|
+
await tx`
|
|
156
244
|
CREATE INDEX IF NOT EXISTS idx_books_ratings_count ON books(ratings_count DESC)
|
|
157
|
-
|
|
245
|
+
`;
|
|
246
|
+
await tx`
|
|
158
247
|
CREATE INDEX IF NOT EXISTS idx_books_is_public ON books(is_public) WHERE deleted_at IS NULL
|
|
159
|
-
|
|
248
|
+
`;
|
|
249
|
+
await tx`
|
|
160
250
|
CREATE INDEX IF NOT EXISTS idx_books_title_lower ON books(LOWER(title)) WHERE deleted_at IS NULL
|
|
161
|
-
|
|
251
|
+
`;
|
|
252
|
+
await tx`
|
|
162
253
|
CREATE INDEX IF NOT EXISTS idx_books_created_at ON books(created_at DESC)
|
|
163
|
-
|
|
254
|
+
`;
|
|
255
|
+
await tx`
|
|
164
256
|
CREATE INDEX IF NOT EXISTS idx_books_updated_at ON books(updated_at DESC)
|
|
165
|
-
|
|
257
|
+
`;
|
|
258
|
+
await tx`
|
|
166
259
|
CREATE INDEX IF NOT EXISTS idx_books_popular ON books(is_public, average_rating DESC, ratings_count DESC) WHERE deleted_at IS NULL
|
|
167
|
-
|
|
260
|
+
`;
|
|
261
|
+
await tx`
|
|
168
262
|
CREATE INDEX IF NOT EXISTS idx_books_active ON books(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
169
|
-
|
|
263
|
+
`;
|
|
264
|
+
await tx`
|
|
170
265
|
CREATE INDEX IF NOT EXISTS idx_books_authors_book_id ON books_authors(book_id)
|
|
171
|
-
|
|
266
|
+
`;
|
|
267
|
+
await tx`
|
|
172
268
|
CREATE INDEX IF NOT EXISTS idx_books_authors_author_id ON books_authors(author_id)
|
|
173
|
-
|
|
269
|
+
`;
|
|
270
|
+
await tx`
|
|
174
271
|
CREATE INDEX IF NOT EXISTS idx_books_tags_book_id ON books_tags(book_id)
|
|
175
|
-
|
|
272
|
+
`;
|
|
273
|
+
await tx`
|
|
176
274
|
CREATE INDEX IF NOT EXISTS idx_books_tags_tag_id ON books_tags(tag_id)
|
|
177
|
-
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
async down(tx) {
|
|
278
|
+
await tx`DROP TABLE IF EXISTS books_tags CASCADE`;
|
|
279
|
+
await tx`DROP TABLE IF EXISTS books_authors CASCADE`;
|
|
280
|
+
await tx`DROP TABLE IF EXISTS books CASCADE`;
|
|
281
|
+
}
|
|
282
|
+
getVersion() {
|
|
283
|
+
return "20251225173355647";
|
|
284
|
+
}
|
|
285
|
+
getDependencies() {
|
|
286
|
+
return [
|
|
287
|
+
Migration20251225173353646,
|
|
288
|
+
Migration20251225173354646,
|
|
289
|
+
Migration20251225173350644,
|
|
290
|
+
Migration20251225173351645,
|
|
291
|
+
Migration20251225173352645
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
Migration20251225173355647 = __legacyDecorateClassTS([
|
|
296
|
+
decorator3.migration()
|
|
297
|
+
], Migration20251225173355647);
|
|
298
|
+
// src/migrations/book/Migration20251225173356648.ts
|
|
299
|
+
import { decorator as decorator4 } from "@ooneex/migrations";
|
|
300
|
+
class Migration20251225173356648 {
|
|
301
|
+
async up(tx) {
|
|
302
|
+
await tx`
|
|
178
303
|
CREATE TABLE IF NOT EXISTS books_stats (
|
|
179
304
|
id VARCHAR(25) PRIMARY KEY,
|
|
180
305
|
book_id VARCHAR(25),
|
|
@@ -198,27 +323,58 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
198
323
|
deleted_at TIMESTAMPTZ,
|
|
199
324
|
CONSTRAINT fk_books_stats_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
200
325
|
)
|
|
201
|
-
|
|
326
|
+
`;
|
|
327
|
+
await tx`
|
|
202
328
|
CREATE INDEX IF NOT EXISTS idx_books_stats_book_id ON books_stats(book_id)
|
|
203
|
-
|
|
329
|
+
`;
|
|
330
|
+
await tx`
|
|
204
331
|
CREATE INDEX IF NOT EXISTS idx_books_stats_likes_count ON books_stats(likes_count DESC)
|
|
205
|
-
|
|
332
|
+
`;
|
|
333
|
+
await tx`
|
|
206
334
|
CREATE INDEX IF NOT EXISTS idx_books_stats_views_count ON books_stats(views_count DESC)
|
|
207
|
-
|
|
335
|
+
`;
|
|
336
|
+
await tx`
|
|
208
337
|
CREATE INDEX IF NOT EXISTS idx_books_stats_downloads_count ON books_stats(downloads_count DESC)
|
|
209
|
-
|
|
338
|
+
`;
|
|
339
|
+
await tx`
|
|
210
340
|
CREATE INDEX IF NOT EXISTS idx_books_stats_language ON books_stats(language)
|
|
211
|
-
|
|
341
|
+
`;
|
|
342
|
+
await tx`
|
|
212
343
|
CREATE INDEX IF NOT EXISTS idx_books_stats_deleted_at ON books_stats(deleted_at)
|
|
213
|
-
|
|
344
|
+
`;
|
|
345
|
+
await tx`
|
|
214
346
|
CREATE INDEX IF NOT EXISTS idx_books_stats_is_public ON books_stats(is_public) WHERE deleted_at IS NULL
|
|
215
|
-
|
|
347
|
+
`;
|
|
348
|
+
await tx`
|
|
216
349
|
CREATE INDEX IF NOT EXISTS idx_books_stats_popular ON books_stats(is_public, likes_count DESC, views_count DESC) WHERE deleted_at IS NULL
|
|
217
|
-
|
|
350
|
+
`;
|
|
351
|
+
await tx`
|
|
218
352
|
CREATE INDEX IF NOT EXISTS idx_books_stats_created_at ON books_stats(created_at DESC)
|
|
219
|
-
|
|
353
|
+
`;
|
|
354
|
+
await tx`
|
|
220
355
|
CREATE INDEX IF NOT EXISTS idx_books_stats_active ON books_stats(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
221
|
-
|
|
356
|
+
`;
|
|
357
|
+
}
|
|
358
|
+
async down(tx) {
|
|
359
|
+
await tx`DROP TABLE IF EXISTS books_stats CASCADE`;
|
|
360
|
+
}
|
|
361
|
+
getVersion() {
|
|
362
|
+
return "20251225173356648";
|
|
363
|
+
}
|
|
364
|
+
getDependencies() {
|
|
365
|
+
return [
|
|
366
|
+
Migration20251225173355647
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
Migration20251225173356648 = __legacyDecorateClassTS([
|
|
371
|
+
decorator4.migration()
|
|
372
|
+
], Migration20251225173356648);
|
|
373
|
+
// src/migrations/book/Migration20251225173357649.ts
|
|
374
|
+
import { decorator as decorator5 } from "@ooneex/migrations";
|
|
375
|
+
class Migration20251225173357649 {
|
|
376
|
+
async up(tx) {
|
|
377
|
+
await tx`
|
|
222
378
|
CREATE TABLE IF NOT EXISTS books_comments (
|
|
223
379
|
id VARCHAR(25) PRIMARY KEY,
|
|
224
380
|
book_id VARCHAR(25),
|
|
@@ -239,25 +395,55 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
239
395
|
CONSTRAINT fk_books_comments_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
|
|
240
396
|
CONSTRAINT fk_books_comments_parent FOREIGN KEY (parent_comment_id) REFERENCES books_comments(id) ON DELETE CASCADE
|
|
241
397
|
)
|
|
242
|
-
|
|
398
|
+
`;
|
|
399
|
+
await tx`
|
|
243
400
|
CREATE INDEX IF NOT EXISTS idx_books_comments_book_id ON books_comments(book_id)
|
|
244
|
-
|
|
401
|
+
`;
|
|
402
|
+
await tx`
|
|
245
403
|
CREATE INDEX IF NOT EXISTS idx_books_comments_commented_by_id ON books_comments(commented_by_id)
|
|
246
|
-
|
|
404
|
+
`;
|
|
405
|
+
await tx`
|
|
247
406
|
CREATE INDEX IF NOT EXISTS idx_books_comments_parent_comment_id ON books_comments(parent_comment_id)
|
|
248
|
-
|
|
407
|
+
`;
|
|
408
|
+
await tx`
|
|
249
409
|
CREATE INDEX IF NOT EXISTS idx_books_comments_language ON books_comments(language)
|
|
250
|
-
|
|
410
|
+
`;
|
|
411
|
+
await tx`
|
|
251
412
|
CREATE INDEX IF NOT EXISTS idx_books_comments_deleted_at ON books_comments(deleted_at)
|
|
252
|
-
|
|
413
|
+
`;
|
|
414
|
+
await tx`
|
|
253
415
|
CREATE INDEX IF NOT EXISTS idx_books_comments_is_public ON books_comments(is_public) WHERE deleted_at IS NULL
|
|
254
|
-
|
|
416
|
+
`;
|
|
417
|
+
await tx`
|
|
255
418
|
CREATE INDEX IF NOT EXISTS idx_books_comments_created_at ON books_comments(created_at DESC)
|
|
256
|
-
|
|
419
|
+
`;
|
|
420
|
+
await tx`
|
|
257
421
|
CREATE INDEX IF NOT EXISTS idx_books_comments_book_created ON books_comments(book_id, created_at DESC) WHERE deleted_at IS NULL
|
|
258
|
-
|
|
422
|
+
`;
|
|
423
|
+
await tx`
|
|
259
424
|
CREATE INDEX IF NOT EXISTS idx_books_comments_active ON books_comments(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
260
|
-
|
|
425
|
+
`;
|
|
426
|
+
}
|
|
427
|
+
async down(tx) {
|
|
428
|
+
await tx`DROP TABLE IF EXISTS books_comments CASCADE`;
|
|
429
|
+
}
|
|
430
|
+
getVersion() {
|
|
431
|
+
return "20251225173357649";
|
|
432
|
+
}
|
|
433
|
+
getDependencies() {
|
|
434
|
+
return [
|
|
435
|
+
Migration20251225173355647
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
Migration20251225173357649 = __legacyDecorateClassTS([
|
|
440
|
+
decorator5.migration()
|
|
441
|
+
], Migration20251225173357649);
|
|
442
|
+
// src/migrations/book/Migration20251225173358650.ts
|
|
443
|
+
import { decorator as decorator6 } from "@ooneex/migrations";
|
|
444
|
+
class Migration20251225173358650 {
|
|
445
|
+
async up(tx) {
|
|
446
|
+
await tx`
|
|
261
447
|
CREATE TABLE IF NOT EXISTS books_liked (
|
|
262
448
|
id VARCHAR(25) PRIMARY KEY,
|
|
263
449
|
book_id VARCHAR(25),
|
|
@@ -275,23 +461,52 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
275
461
|
deleted_at TIMESTAMPTZ,
|
|
276
462
|
CONSTRAINT fk_books_liked_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
277
463
|
)
|
|
278
|
-
|
|
464
|
+
`;
|
|
465
|
+
await tx`
|
|
279
466
|
CREATE INDEX IF NOT EXISTS idx_books_liked_book_id ON books_liked(book_id)
|
|
280
|
-
|
|
467
|
+
`;
|
|
468
|
+
await tx`
|
|
281
469
|
CREATE INDEX IF NOT EXISTS idx_books_liked_liked_by_id ON books_liked(liked_by_id)
|
|
282
|
-
|
|
470
|
+
`;
|
|
471
|
+
await tx`
|
|
283
472
|
CREATE INDEX IF NOT EXISTS idx_books_liked_language ON books_liked(language)
|
|
284
|
-
|
|
473
|
+
`;
|
|
474
|
+
await tx`
|
|
285
475
|
CREATE INDEX IF NOT EXISTS idx_books_liked_deleted_at ON books_liked(deleted_at)
|
|
286
|
-
|
|
476
|
+
`;
|
|
477
|
+
await tx`
|
|
287
478
|
CREATE INDEX IF NOT EXISTS idx_books_liked_is_public ON books_liked(is_public) WHERE deleted_at IS NULL
|
|
288
|
-
|
|
479
|
+
`;
|
|
480
|
+
await tx`
|
|
289
481
|
CREATE INDEX IF NOT EXISTS idx_books_liked_created_at ON books_liked(created_at DESC)
|
|
290
|
-
|
|
482
|
+
`;
|
|
483
|
+
await tx`
|
|
291
484
|
CREATE INDEX IF NOT EXISTS idx_books_liked_book_user ON books_liked(book_id, liked_by_id) WHERE deleted_at IS NULL
|
|
292
|
-
|
|
485
|
+
`;
|
|
486
|
+
await tx`
|
|
293
487
|
CREATE INDEX IF NOT EXISTS idx_books_liked_active ON books_liked(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
294
|
-
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
async down(tx) {
|
|
491
|
+
await tx`DROP TABLE IF EXISTS books_liked CASCADE`;
|
|
492
|
+
}
|
|
493
|
+
getVersion() {
|
|
494
|
+
return "20251225173358650";
|
|
495
|
+
}
|
|
496
|
+
getDependencies() {
|
|
497
|
+
return [
|
|
498
|
+
Migration20251225173355647
|
|
499
|
+
];
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
Migration20251225173358650 = __legacyDecorateClassTS([
|
|
503
|
+
decorator6.migration()
|
|
504
|
+
], Migration20251225173358650);
|
|
505
|
+
// src/migrations/book/Migration20251225173359651.ts
|
|
506
|
+
import { decorator as decorator7 } from "@ooneex/migrations";
|
|
507
|
+
class Migration20251225173359651 {
|
|
508
|
+
async up(tx) {
|
|
509
|
+
await tx`
|
|
295
510
|
CREATE TABLE IF NOT EXISTS books_disliked (
|
|
296
511
|
id VARCHAR(25) PRIMARY KEY,
|
|
297
512
|
book_id VARCHAR(25),
|
|
@@ -309,23 +524,52 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
309
524
|
deleted_at TIMESTAMPTZ,
|
|
310
525
|
CONSTRAINT fk_books_disliked_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
311
526
|
)
|
|
312
|
-
|
|
527
|
+
`;
|
|
528
|
+
await tx`
|
|
313
529
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_book_id ON books_disliked(book_id)
|
|
314
|
-
|
|
530
|
+
`;
|
|
531
|
+
await tx`
|
|
315
532
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_disliked_by_id ON books_disliked(disliked_by_id)
|
|
316
|
-
|
|
533
|
+
`;
|
|
534
|
+
await tx`
|
|
317
535
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_language ON books_disliked(language)
|
|
318
|
-
|
|
536
|
+
`;
|
|
537
|
+
await tx`
|
|
319
538
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_deleted_at ON books_disliked(deleted_at)
|
|
320
|
-
|
|
539
|
+
`;
|
|
540
|
+
await tx`
|
|
321
541
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_is_public ON books_disliked(is_public) WHERE deleted_at IS NULL
|
|
322
|
-
|
|
542
|
+
`;
|
|
543
|
+
await tx`
|
|
323
544
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_created_at ON books_disliked(created_at DESC)
|
|
324
|
-
|
|
545
|
+
`;
|
|
546
|
+
await tx`
|
|
325
547
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_book_user ON books_disliked(book_id, disliked_by_id) WHERE deleted_at IS NULL
|
|
326
|
-
|
|
548
|
+
`;
|
|
549
|
+
await tx`
|
|
327
550
|
CREATE INDEX IF NOT EXISTS idx_books_disliked_active ON books_disliked(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
328
|
-
|
|
551
|
+
`;
|
|
552
|
+
}
|
|
553
|
+
async down(tx) {
|
|
554
|
+
await tx`DROP TABLE IF EXISTS books_disliked CASCADE`;
|
|
555
|
+
}
|
|
556
|
+
getVersion() {
|
|
557
|
+
return "20251225173359651";
|
|
558
|
+
}
|
|
559
|
+
getDependencies() {
|
|
560
|
+
return [
|
|
561
|
+
Migration20251225173355647
|
|
562
|
+
];
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
Migration20251225173359651 = __legacyDecorateClassTS([
|
|
566
|
+
decorator7.migration()
|
|
567
|
+
], Migration20251225173359651);
|
|
568
|
+
// src/migrations/book/Migration20251225173400652.ts
|
|
569
|
+
import { decorator as decorator8 } from "@ooneex/migrations";
|
|
570
|
+
class Migration20251225173400652 {
|
|
571
|
+
async up(tx) {
|
|
572
|
+
await tx`
|
|
329
573
|
CREATE TABLE IF NOT EXISTS books_viewed (
|
|
330
574
|
id VARCHAR(25) PRIMARY KEY,
|
|
331
575
|
book_id VARCHAR(25),
|
|
@@ -343,23 +587,52 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
343
587
|
deleted_at TIMESTAMPTZ,
|
|
344
588
|
CONSTRAINT fk_books_viewed_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
345
589
|
)
|
|
346
|
-
|
|
590
|
+
`;
|
|
591
|
+
await tx`
|
|
347
592
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_book_id ON books_viewed(book_id)
|
|
348
|
-
|
|
593
|
+
`;
|
|
594
|
+
await tx`
|
|
349
595
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_viewed_by_id ON books_viewed(viewed_by_id)
|
|
350
|
-
|
|
596
|
+
`;
|
|
597
|
+
await tx`
|
|
351
598
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_language ON books_viewed(language)
|
|
352
|
-
|
|
599
|
+
`;
|
|
600
|
+
await tx`
|
|
353
601
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_deleted_at ON books_viewed(deleted_at)
|
|
354
|
-
|
|
602
|
+
`;
|
|
603
|
+
await tx`
|
|
355
604
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_is_public ON books_viewed(is_public) WHERE deleted_at IS NULL
|
|
356
|
-
|
|
605
|
+
`;
|
|
606
|
+
await tx`
|
|
357
607
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_created_at ON books_viewed(created_at DESC)
|
|
358
|
-
|
|
608
|
+
`;
|
|
609
|
+
await tx`
|
|
359
610
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_book_user ON books_viewed(book_id, viewed_by_id) WHERE deleted_at IS NULL
|
|
360
|
-
|
|
611
|
+
`;
|
|
612
|
+
await tx`
|
|
361
613
|
CREATE INDEX IF NOT EXISTS idx_books_viewed_active ON books_viewed(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
362
|
-
|
|
614
|
+
`;
|
|
615
|
+
}
|
|
616
|
+
async down(tx) {
|
|
617
|
+
await tx`DROP TABLE IF EXISTS books_viewed CASCADE`;
|
|
618
|
+
}
|
|
619
|
+
getVersion() {
|
|
620
|
+
return "20251225173400652";
|
|
621
|
+
}
|
|
622
|
+
getDependencies() {
|
|
623
|
+
return [
|
|
624
|
+
Migration20251225173355647
|
|
625
|
+
];
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
Migration20251225173400652 = __legacyDecorateClassTS([
|
|
629
|
+
decorator8.migration()
|
|
630
|
+
], Migration20251225173400652);
|
|
631
|
+
// src/migrations/book/Migration20251225173401654.ts
|
|
632
|
+
import { decorator as decorator9 } from "@ooneex/migrations";
|
|
633
|
+
class Migration20251225173401654 {
|
|
634
|
+
async up(tx) {
|
|
635
|
+
await tx`
|
|
363
636
|
CREATE TABLE IF NOT EXISTS books_saved (
|
|
364
637
|
id VARCHAR(25) PRIMARY KEY,
|
|
365
638
|
book_id VARCHAR(25),
|
|
@@ -377,23 +650,52 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
377
650
|
deleted_at TIMESTAMPTZ,
|
|
378
651
|
CONSTRAINT fk_books_saved_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
379
652
|
)
|
|
380
|
-
|
|
653
|
+
`;
|
|
654
|
+
await tx`
|
|
381
655
|
CREATE INDEX IF NOT EXISTS idx_books_saved_book_id ON books_saved(book_id)
|
|
382
|
-
|
|
656
|
+
`;
|
|
657
|
+
await tx`
|
|
383
658
|
CREATE INDEX IF NOT EXISTS idx_books_saved_saved_by_id ON books_saved(saved_by_id)
|
|
384
|
-
|
|
659
|
+
`;
|
|
660
|
+
await tx`
|
|
385
661
|
CREATE INDEX IF NOT EXISTS idx_books_saved_language ON books_saved(language)
|
|
386
|
-
|
|
662
|
+
`;
|
|
663
|
+
await tx`
|
|
387
664
|
CREATE INDEX IF NOT EXISTS idx_books_saved_deleted_at ON books_saved(deleted_at)
|
|
388
|
-
|
|
665
|
+
`;
|
|
666
|
+
await tx`
|
|
389
667
|
CREATE INDEX IF NOT EXISTS idx_books_saved_is_public ON books_saved(is_public) WHERE deleted_at IS NULL
|
|
390
|
-
|
|
668
|
+
`;
|
|
669
|
+
await tx`
|
|
391
670
|
CREATE INDEX IF NOT EXISTS idx_books_saved_created_at ON books_saved(created_at DESC)
|
|
392
|
-
|
|
671
|
+
`;
|
|
672
|
+
await tx`
|
|
393
673
|
CREATE INDEX IF NOT EXISTS idx_books_saved_book_user ON books_saved(book_id, saved_by_id) WHERE deleted_at IS NULL
|
|
394
|
-
|
|
674
|
+
`;
|
|
675
|
+
await tx`
|
|
395
676
|
CREATE INDEX IF NOT EXISTS idx_books_saved_active ON books_saved(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
396
|
-
|
|
677
|
+
`;
|
|
678
|
+
}
|
|
679
|
+
async down(tx) {
|
|
680
|
+
await tx`DROP TABLE IF EXISTS books_saved CASCADE`;
|
|
681
|
+
}
|
|
682
|
+
getVersion() {
|
|
683
|
+
return "20251225173401654";
|
|
684
|
+
}
|
|
685
|
+
getDependencies() {
|
|
686
|
+
return [
|
|
687
|
+
Migration20251225173355647
|
|
688
|
+
];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
Migration20251225173401654 = __legacyDecorateClassTS([
|
|
692
|
+
decorator9.migration()
|
|
693
|
+
], Migration20251225173401654);
|
|
694
|
+
// src/migrations/book/Migration20251225173402655.ts
|
|
695
|
+
import { decorator as decorator10 } from "@ooneex/migrations";
|
|
696
|
+
class Migration20251225173402655 {
|
|
697
|
+
async up(tx) {
|
|
698
|
+
await tx`
|
|
397
699
|
CREATE TABLE IF NOT EXISTS books_downloaded (
|
|
398
700
|
id VARCHAR(25) PRIMARY KEY,
|
|
399
701
|
book_id VARCHAR(25),
|
|
@@ -411,23 +713,52 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
411
713
|
deleted_at TIMESTAMPTZ,
|
|
412
714
|
CONSTRAINT fk_books_downloaded_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
413
715
|
)
|
|
414
|
-
|
|
716
|
+
`;
|
|
717
|
+
await tx`
|
|
415
718
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_book_id ON books_downloaded(book_id)
|
|
416
|
-
|
|
719
|
+
`;
|
|
720
|
+
await tx`
|
|
417
721
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_downloaded_by_id ON books_downloaded(downloaded_by_id)
|
|
418
|
-
|
|
722
|
+
`;
|
|
723
|
+
await tx`
|
|
419
724
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_language ON books_downloaded(language)
|
|
420
|
-
|
|
725
|
+
`;
|
|
726
|
+
await tx`
|
|
421
727
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_deleted_at ON books_downloaded(deleted_at)
|
|
422
|
-
|
|
728
|
+
`;
|
|
729
|
+
await tx`
|
|
423
730
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_is_public ON books_downloaded(is_public) WHERE deleted_at IS NULL
|
|
424
|
-
|
|
731
|
+
`;
|
|
732
|
+
await tx`
|
|
425
733
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_created_at ON books_downloaded(created_at DESC)
|
|
426
|
-
|
|
734
|
+
`;
|
|
735
|
+
await tx`
|
|
427
736
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_book_user ON books_downloaded(book_id, downloaded_by_id) WHERE deleted_at IS NULL
|
|
428
|
-
|
|
737
|
+
`;
|
|
738
|
+
await tx`
|
|
429
739
|
CREATE INDEX IF NOT EXISTS idx_books_downloaded_active ON books_downloaded(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
430
|
-
|
|
740
|
+
`;
|
|
741
|
+
}
|
|
742
|
+
async down(tx) {
|
|
743
|
+
await tx`DROP TABLE IF EXISTS books_downloaded CASCADE`;
|
|
744
|
+
}
|
|
745
|
+
getVersion() {
|
|
746
|
+
return "20251225173402655";
|
|
747
|
+
}
|
|
748
|
+
getDependencies() {
|
|
749
|
+
return [
|
|
750
|
+
Migration20251225173355647
|
|
751
|
+
];
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
Migration20251225173402655 = __legacyDecorateClassTS([
|
|
755
|
+
decorator10.migration()
|
|
756
|
+
], Migration20251225173402655);
|
|
757
|
+
// src/migrations/book/Migration20251225173403656.ts
|
|
758
|
+
import { decorator as decorator11 } from "@ooneex/migrations";
|
|
759
|
+
class Migration20251225173403656 {
|
|
760
|
+
async up(tx) {
|
|
761
|
+
await tx`
|
|
431
762
|
CREATE TABLE IF NOT EXISTS books_shared (
|
|
432
763
|
id VARCHAR(25) PRIMARY KEY,
|
|
433
764
|
book_id VARCHAR(25),
|
|
@@ -447,29 +778,61 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
447
778
|
deleted_at TIMESTAMPTZ,
|
|
448
779
|
CONSTRAINT fk_books_shared_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE
|
|
449
780
|
)
|
|
450
|
-
|
|
781
|
+
`;
|
|
782
|
+
await tx`
|
|
451
783
|
CREATE INDEX IF NOT EXISTS idx_books_shared_book_id ON books_shared(book_id)
|
|
452
|
-
|
|
784
|
+
`;
|
|
785
|
+
await tx`
|
|
453
786
|
CREATE INDEX IF NOT EXISTS idx_books_shared_shared_by_id ON books_shared(shared_by_id)
|
|
454
|
-
|
|
787
|
+
`;
|
|
788
|
+
await tx`
|
|
455
789
|
CREATE INDEX IF NOT EXISTS idx_books_shared_permission ON books_shared(permission)
|
|
456
|
-
|
|
790
|
+
`;
|
|
791
|
+
await tx`
|
|
457
792
|
CREATE INDEX IF NOT EXISTS idx_books_shared_expires_at ON books_shared(expires_at)
|
|
458
|
-
|
|
793
|
+
`;
|
|
794
|
+
await tx`
|
|
459
795
|
CREATE INDEX IF NOT EXISTS idx_books_shared_language ON books_shared(language)
|
|
460
|
-
|
|
796
|
+
`;
|
|
797
|
+
await tx`
|
|
461
798
|
CREATE INDEX IF NOT EXISTS idx_books_shared_deleted_at ON books_shared(deleted_at)
|
|
462
|
-
|
|
799
|
+
`;
|
|
800
|
+
await tx`
|
|
463
801
|
CREATE INDEX IF NOT EXISTS idx_books_shared_is_public ON books_shared(is_public) WHERE deleted_at IS NULL
|
|
464
|
-
|
|
802
|
+
`;
|
|
803
|
+
await tx`
|
|
465
804
|
CREATE INDEX IF NOT EXISTS idx_books_shared_created_at ON books_shared(created_at DESC)
|
|
466
|
-
|
|
805
|
+
`;
|
|
806
|
+
await tx`
|
|
467
807
|
CREATE INDEX IF NOT EXISTS idx_books_shared_book_user ON books_shared(book_id, shared_by_id) WHERE deleted_at IS NULL
|
|
468
|
-
|
|
808
|
+
`;
|
|
809
|
+
await tx`
|
|
469
810
|
CREATE INDEX IF NOT EXISTS idx_books_shared_active ON books_shared(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
470
|
-
|
|
811
|
+
`;
|
|
812
|
+
await tx`
|
|
471
813
|
CREATE INDEX IF NOT EXISTS idx_books_shared_active_not_expired ON books_shared(expires_at) WHERE deleted_at IS NULL AND expires_at > NOW()
|
|
472
|
-
|
|
814
|
+
`;
|
|
815
|
+
}
|
|
816
|
+
async down(tx) {
|
|
817
|
+
await tx`DROP TABLE IF EXISTS books_shared CASCADE`;
|
|
818
|
+
}
|
|
819
|
+
getVersion() {
|
|
820
|
+
return "20251225173403656";
|
|
821
|
+
}
|
|
822
|
+
getDependencies() {
|
|
823
|
+
return [
|
|
824
|
+
Migration20251225173355647
|
|
825
|
+
];
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
Migration20251225173403656 = __legacyDecorateClassTS([
|
|
829
|
+
decorator11.migration()
|
|
830
|
+
], Migration20251225173403656);
|
|
831
|
+
// src/migrations/book/Migration20251225173404658.ts
|
|
832
|
+
import { decorator as decorator12 } from "@ooneex/migrations";
|
|
833
|
+
class Migration20251225173404658 {
|
|
834
|
+
async up(tx) {
|
|
835
|
+
await tx`
|
|
473
836
|
CREATE TABLE IF NOT EXISTS books_reports (
|
|
474
837
|
id VARCHAR(25) PRIMARY KEY,
|
|
475
838
|
book_id VARCHAR(25),
|
|
@@ -491,26 +854,67 @@ import{b as p}from"../../../shared/chunk-qrs0g3m9.js";import{c as O}from"../../.
|
|
|
491
854
|
CONSTRAINT fk_books_reports_book FOREIGN KEY (book_id) REFERENCES books(id) ON DELETE CASCADE,
|
|
492
855
|
CONSTRAINT fk_books_reports_status FOREIGN KEY (status_id) REFERENCES statuses(id) ON DELETE SET NULL
|
|
493
856
|
)
|
|
494
|
-
|
|
857
|
+
`;
|
|
858
|
+
await tx`
|
|
495
859
|
CREATE INDEX IF NOT EXISTS idx_books_reports_book_id ON books_reports(book_id)
|
|
496
|
-
|
|
860
|
+
`;
|
|
861
|
+
await tx`
|
|
497
862
|
CREATE INDEX IF NOT EXISTS idx_books_reports_reported_by_id ON books_reports(reported_by_id)
|
|
498
|
-
|
|
863
|
+
`;
|
|
864
|
+
await tx`
|
|
499
865
|
CREATE INDEX IF NOT EXISTS idx_books_reports_status_id ON books_reports(status_id)
|
|
500
|
-
|
|
866
|
+
`;
|
|
867
|
+
await tx`
|
|
501
868
|
CREATE INDEX IF NOT EXISTS idx_books_reports_reason ON books_reports(reason)
|
|
502
|
-
|
|
869
|
+
`;
|
|
870
|
+
await tx`
|
|
503
871
|
CREATE INDEX IF NOT EXISTS idx_books_reports_language ON books_reports(language)
|
|
504
|
-
|
|
872
|
+
`;
|
|
873
|
+
await tx`
|
|
505
874
|
CREATE INDEX IF NOT EXISTS idx_books_reports_deleted_at ON books_reports(deleted_at)
|
|
506
|
-
|
|
875
|
+
`;
|
|
876
|
+
await tx`
|
|
507
877
|
CREATE INDEX IF NOT EXISTS idx_books_reports_is_public ON books_reports(is_public) WHERE deleted_at IS NULL
|
|
508
|
-
|
|
878
|
+
`;
|
|
879
|
+
await tx`
|
|
509
880
|
CREATE INDEX IF NOT EXISTS idx_books_reports_created_at ON books_reports(created_at DESC)
|
|
510
|
-
|
|
881
|
+
`;
|
|
882
|
+
await tx`
|
|
511
883
|
CREATE INDEX IF NOT EXISTS idx_books_reports_book_status ON books_reports(book_id, status_id) WHERE deleted_at IS NULL
|
|
512
|
-
|
|
884
|
+
`;
|
|
885
|
+
await tx`
|
|
513
886
|
CREATE INDEX IF NOT EXISTS idx_books_reports_active ON books_reports(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
514
|
-
|
|
887
|
+
`;
|
|
888
|
+
}
|
|
889
|
+
async down(tx) {
|
|
890
|
+
await tx`DROP TABLE IF EXISTS books_reports CASCADE`;
|
|
891
|
+
}
|
|
892
|
+
getVersion() {
|
|
893
|
+
return "20251225173404658";
|
|
894
|
+
}
|
|
895
|
+
getDependencies() {
|
|
896
|
+
return [
|
|
897
|
+
Migration20251225173355647,
|
|
898
|
+
Migration20251225173350644
|
|
899
|
+
];
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
Migration20251225173404658 = __legacyDecorateClassTS([
|
|
903
|
+
decorator12.migration()
|
|
904
|
+
], Migration20251225173404658);
|
|
905
|
+
export {
|
|
906
|
+
Migration20251225173404658,
|
|
907
|
+
Migration20251225173403656,
|
|
908
|
+
Migration20251225173402655,
|
|
909
|
+
Migration20251225173401654,
|
|
910
|
+
Migration20251225173400652,
|
|
911
|
+
Migration20251225173359651,
|
|
912
|
+
Migration20251225173358650,
|
|
913
|
+
Migration20251225173357649,
|
|
914
|
+
Migration20251225173356648,
|
|
915
|
+
Migration20251225173355647,
|
|
916
|
+
Migration20251225173354646,
|
|
917
|
+
Migration20251225173353646
|
|
918
|
+
};
|
|
515
919
|
|
|
516
|
-
//# debugId=
|
|
920
|
+
//# debugId=6515CCEFF219B66064756E2164756E21
|