@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
|
+
Migration20251225173351645
|
|
4
|
+
} from "../../../../shared/chunk-jap9t59k.js";
|
|
5
|
+
import {
|
|
6
|
+
Migration20251225173350644
|
|
7
|
+
} from "../../../../shared/chunk-trhrh4e1.js";
|
|
8
|
+
import {
|
|
9
|
+
Migration20251225180910444
|
|
10
|
+
} from "../../../../shared/chunk-yszvxhf3.js";
|
|
11
|
+
import {
|
|
12
|
+
__legacyDecorateClassTS
|
|
13
|
+
} from "../../../../shared/chunk-r9hsk9fk.js";
|
|
14
|
+
|
|
15
|
+
// src/migrations/gamification/mcq/Migration20251225180910446.ts
|
|
16
|
+
import { decorator } from "@ooneex/migrations";
|
|
17
|
+
class Migration20251225180910446 {
|
|
18
|
+
async up(tx) {
|
|
19
|
+
await tx`
|
|
3
20
|
CREATE TABLE IF NOT EXISTS mcq_questions (
|
|
4
21
|
id VARCHAR(25) PRIMARY KEY,
|
|
5
22
|
question_number INT NOT NULL,
|
|
@@ -21,7 +38,8 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
21
38
|
deleted_at TIMESTAMPTZ,
|
|
22
39
|
CONSTRAINT fk_mcq_questions_status FOREIGN KEY (status_id) REFERENCES statuses(id) ON DELETE SET NULL
|
|
23
40
|
)
|
|
24
|
-
|
|
41
|
+
`;
|
|
42
|
+
await tx`
|
|
25
43
|
CREATE TABLE IF NOT EXISTS mcq_questions_tags (
|
|
26
44
|
question_id VARCHAR(25) NOT NULL,
|
|
27
45
|
tag_id VARCHAR(25) NOT NULL,
|
|
@@ -29,35 +47,72 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
29
47
|
CONSTRAINT fk_mcq_questions_tags_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE,
|
|
30
48
|
CONSTRAINT fk_mcq_questions_tags_tag FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE
|
|
31
49
|
)
|
|
32
|
-
|
|
50
|
+
`;
|
|
51
|
+
await tx`
|
|
33
52
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_question_number ON mcq_questions(question_number)
|
|
34
|
-
|
|
53
|
+
`;
|
|
54
|
+
await tx`
|
|
35
55
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_context ON mcq_questions(context, context_id)
|
|
36
|
-
|
|
56
|
+
`;
|
|
57
|
+
await tx`
|
|
37
58
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stat_id ON mcq_questions(stat_id)
|
|
38
|
-
|
|
59
|
+
`;
|
|
60
|
+
await tx`
|
|
39
61
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_status_id ON mcq_questions(status_id)
|
|
40
|
-
|
|
62
|
+
`;
|
|
63
|
+
await tx`
|
|
41
64
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_image_id ON mcq_questions(image_id)
|
|
42
|
-
|
|
65
|
+
`;
|
|
66
|
+
await tx`
|
|
43
67
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_language ON mcq_questions(language)
|
|
44
|
-
|
|
68
|
+
`;
|
|
69
|
+
await tx`
|
|
45
70
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_deleted_at ON mcq_questions(deleted_at)
|
|
46
|
-
|
|
71
|
+
`;
|
|
72
|
+
await tx`
|
|
47
73
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_is_public ON mcq_questions(is_public) WHERE deleted_at IS NULL
|
|
48
|
-
|
|
74
|
+
`;
|
|
75
|
+
await tx`
|
|
49
76
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_created_at ON mcq_questions(created_at DESC)
|
|
50
|
-
|
|
77
|
+
`;
|
|
78
|
+
await tx`
|
|
51
79
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_updated_at ON mcq_questions(updated_at DESC)
|
|
52
|
-
|
|
80
|
+
`;
|
|
81
|
+
await tx`
|
|
53
82
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_active ON mcq_questions(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
54
|
-
|
|
83
|
+
`;
|
|
84
|
+
await tx`
|
|
55
85
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_tags_question_id ON mcq_questions_tags(question_id)
|
|
56
|
-
|
|
86
|
+
`;
|
|
87
|
+
await tx`
|
|
57
88
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_tags_tag_id ON mcq_questions_tags(tag_id)
|
|
58
|
-
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
async down(tx) {
|
|
92
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_tags CASCADE`;
|
|
93
|
+
await tx`DROP TABLE IF EXISTS mcq_questions CASCADE`;
|
|
94
|
+
}
|
|
95
|
+
getVersion() {
|
|
96
|
+
return "20251225180910446";
|
|
97
|
+
}
|
|
98
|
+
getDependencies() {
|
|
99
|
+
return [
|
|
100
|
+
Migration20251225173350644,
|
|
101
|
+
Migration20251225173351645
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
Migration20251225180910446 = __legacyDecorateClassTS([
|
|
106
|
+
decorator.migration()
|
|
107
|
+
], Migration20251225180910446);
|
|
108
|
+
// src/migrations/gamification/mcq/Migration20251225180910449.ts
|
|
109
|
+
import { decorator as decorator2 } from "@ooneex/migrations";
|
|
110
|
+
class Migration20251225180910449 {
|
|
111
|
+
async up(tx) {
|
|
112
|
+
await tx`
|
|
59
113
|
CREATE TYPE mcq_choice_letter AS ENUM ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J')
|
|
60
|
-
|
|
114
|
+
`;
|
|
115
|
+
await tx`
|
|
61
116
|
CREATE TABLE IF NOT EXISTS mcq_question_choices (
|
|
62
117
|
id VARCHAR(25) PRIMARY KEY,
|
|
63
118
|
letter mcq_choice_letter NOT NULL,
|
|
@@ -77,32 +132,65 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
77
132
|
deleted_at TIMESTAMPTZ,
|
|
78
133
|
CONSTRAINT fk_mcq_question_choices_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
79
134
|
)
|
|
80
|
-
|
|
135
|
+
`;
|
|
136
|
+
await tx`
|
|
81
137
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_question_id ON mcq_question_choices(question_id)
|
|
82
|
-
|
|
138
|
+
`;
|
|
139
|
+
await tx`
|
|
83
140
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_letter ON mcq_question_choices(letter)
|
|
84
|
-
|
|
141
|
+
`;
|
|
142
|
+
await tx`
|
|
85
143
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_is_correct ON mcq_question_choices(is_correct)
|
|
86
|
-
|
|
144
|
+
`;
|
|
145
|
+
await tx`
|
|
87
146
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_language ON mcq_question_choices(language)
|
|
88
|
-
|
|
147
|
+
`;
|
|
148
|
+
await tx`
|
|
89
149
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_deleted_at ON mcq_question_choices(deleted_at)
|
|
90
|
-
|
|
150
|
+
`;
|
|
151
|
+
await tx`
|
|
91
152
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_is_public ON mcq_question_choices(is_public) WHERE deleted_at IS NULL
|
|
92
|
-
|
|
153
|
+
`;
|
|
154
|
+
await tx`
|
|
93
155
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_created_at ON mcq_question_choices(created_at DESC)
|
|
94
|
-
|
|
156
|
+
`;
|
|
157
|
+
await tx`
|
|
95
158
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_active ON mcq_question_choices(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
96
|
-
|
|
159
|
+
`;
|
|
160
|
+
await tx`
|
|
97
161
|
CREATE INDEX IF NOT EXISTS idx_mcq_question_choices_question_letter ON mcq_question_choices(question_id, letter)
|
|
98
|
-
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
async down(tx) {
|
|
165
|
+
await tx`DROP TABLE IF EXISTS mcq_question_choices CASCADE`;
|
|
166
|
+
await tx`DROP TYPE IF EXISTS mcq_choice_letter CASCADE`;
|
|
167
|
+
}
|
|
168
|
+
getVersion() {
|
|
169
|
+
return "20251225180910449";
|
|
170
|
+
}
|
|
171
|
+
getDependencies() {
|
|
172
|
+
return [
|
|
173
|
+
Migration20251225180910446
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
Migration20251225180910449 = __legacyDecorateClassTS([
|
|
178
|
+
decorator2.migration()
|
|
179
|
+
], Migration20251225180910449);
|
|
180
|
+
// src/migrations/gamification/mcq/Migration20251225180910451.ts
|
|
181
|
+
import { decorator as decorator3 } from "@ooneex/migrations";
|
|
182
|
+
class Migration20251225180910451 {
|
|
183
|
+
async up(tx) {
|
|
184
|
+
await tx`
|
|
99
185
|
CREATE TYPE mcq_session_status AS ENUM ('DRAFT', 'IN_PROGRESS', 'PAUSED', 'COMPLETED', 'CANCELLED')
|
|
100
|
-
|
|
186
|
+
`;
|
|
187
|
+
await tx`
|
|
101
188
|
CREATE TYPE session_type AS ENUM (
|
|
102
189
|
'TRAINING', 'PRACTICE', 'SIMULATION', 'QUIZ',
|
|
103
190
|
'CHALLENGE', 'TOURNAMENT', 'REVIEW', 'DIAGNOSTIC', 'SPEED_TEST'
|
|
104
191
|
)
|
|
105
|
-
|
|
192
|
+
`;
|
|
193
|
+
await tx`
|
|
106
194
|
CREATE TABLE IF NOT EXISTS mcq_sessions (
|
|
107
195
|
id VARCHAR(25) PRIMARY KEY,
|
|
108
196
|
name VARCHAR(500) NOT NULL,
|
|
@@ -131,7 +219,8 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
131
219
|
deleted_at TIMESTAMPTZ,
|
|
132
220
|
CONSTRAINT fk_mcq_sessions_level FOREIGN KEY (level_id) REFERENCES levels(id) ON DELETE RESTRICT
|
|
133
221
|
)
|
|
134
|
-
|
|
222
|
+
`;
|
|
223
|
+
await tx`
|
|
135
224
|
CREATE TABLE IF NOT EXISTS mcq_sessions_questions (
|
|
136
225
|
session_id VARCHAR(25) NOT NULL,
|
|
137
226
|
question_id VARCHAR(25) NOT NULL,
|
|
@@ -139,41 +228,83 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
139
228
|
CONSTRAINT fk_mcq_sessions_questions_session FOREIGN KEY (session_id) REFERENCES mcq_sessions(id) ON DELETE CASCADE,
|
|
140
229
|
CONSTRAINT fk_mcq_sessions_questions_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
141
230
|
)
|
|
142
|
-
|
|
231
|
+
`;
|
|
232
|
+
await tx`
|
|
143
233
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_name ON mcq_sessions(name)
|
|
144
|
-
|
|
234
|
+
`;
|
|
235
|
+
await tx`
|
|
145
236
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_status ON mcq_sessions(status)
|
|
146
|
-
|
|
237
|
+
`;
|
|
238
|
+
await tx`
|
|
147
239
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_type ON mcq_sessions(type)
|
|
148
|
-
|
|
240
|
+
`;
|
|
241
|
+
await tx`
|
|
149
242
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_level_id ON mcq_sessions(level_id)
|
|
150
|
-
|
|
243
|
+
`;
|
|
244
|
+
await tx`
|
|
151
245
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_score ON mcq_sessions(score DESC)
|
|
152
|
-
|
|
246
|
+
`;
|
|
247
|
+
await tx`
|
|
153
248
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_started_at ON mcq_sessions(started_at DESC)
|
|
154
|
-
|
|
249
|
+
`;
|
|
250
|
+
await tx`
|
|
155
251
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_completed_at ON mcq_sessions(completed_at DESC)
|
|
156
|
-
|
|
252
|
+
`;
|
|
253
|
+
await tx`
|
|
157
254
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_language ON mcq_sessions(language)
|
|
158
|
-
|
|
255
|
+
`;
|
|
256
|
+
await tx`
|
|
159
257
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_deleted_at ON mcq_sessions(deleted_at)
|
|
160
|
-
|
|
258
|
+
`;
|
|
259
|
+
await tx`
|
|
161
260
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_is_public ON mcq_sessions(is_public) WHERE deleted_at IS NULL
|
|
162
|
-
|
|
261
|
+
`;
|
|
262
|
+
await tx`
|
|
163
263
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_created_at ON mcq_sessions(created_at DESC)
|
|
164
|
-
|
|
264
|
+
`;
|
|
265
|
+
await tx`
|
|
165
266
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_updated_at ON mcq_sessions(updated_at DESC)
|
|
166
|
-
|
|
267
|
+
`;
|
|
268
|
+
await tx`
|
|
167
269
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_active ON mcq_sessions(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
168
|
-
|
|
270
|
+
`;
|
|
271
|
+
await tx`
|
|
169
272
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_performance ON mcq_sessions(type, score DESC, completed_at DESC) WHERE status = 'COMPLETED' AND deleted_at IS NULL
|
|
170
|
-
|
|
273
|
+
`;
|
|
274
|
+
await tx`
|
|
171
275
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_questions_session_id ON mcq_sessions_questions(session_id)
|
|
172
|
-
|
|
276
|
+
`;
|
|
277
|
+
await tx`
|
|
173
278
|
CREATE INDEX IF NOT EXISTS idx_mcq_sessions_questions_question_id ON mcq_sessions_questions(question_id)
|
|
174
|
-
|
|
279
|
+
`;
|
|
280
|
+
}
|
|
281
|
+
async down(tx) {
|
|
282
|
+
await tx`DROP TABLE IF EXISTS mcq_sessions_questions CASCADE`;
|
|
283
|
+
await tx`DROP TABLE IF EXISTS mcq_sessions CASCADE`;
|
|
284
|
+
await tx`DROP TYPE IF EXISTS session_type CASCADE`;
|
|
285
|
+
await tx`DROP TYPE IF EXISTS mcq_session_status CASCADE`;
|
|
286
|
+
}
|
|
287
|
+
getVersion() {
|
|
288
|
+
return "20251225180910451";
|
|
289
|
+
}
|
|
290
|
+
getDependencies() {
|
|
291
|
+
return [
|
|
292
|
+
Migration20251225180910444,
|
|
293
|
+
Migration20251225180910446
|
|
294
|
+
];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
Migration20251225180910451 = __legacyDecorateClassTS([
|
|
298
|
+
decorator3.migration()
|
|
299
|
+
], Migration20251225180910451);
|
|
300
|
+
// src/migrations/gamification/mcq/Migration20251225180910453.ts
|
|
301
|
+
import { decorator as decorator4 } from "@ooneex/migrations";
|
|
302
|
+
class Migration20251225180910453 {
|
|
303
|
+
async up(tx) {
|
|
304
|
+
await tx`
|
|
175
305
|
CREATE TYPE answer_state AS ENUM ('UNANSWERED', 'CORRECT', 'INCORRECT', 'PARTIAL', 'SKIPPED')
|
|
176
|
-
|
|
306
|
+
`;
|
|
307
|
+
await tx`
|
|
177
308
|
CREATE TABLE IF NOT EXISTS mcq_session_questions (
|
|
178
309
|
id VARCHAR(25) PRIMARY KEY,
|
|
179
310
|
session_id VARCHAR(25) NOT NULL,
|
|
@@ -196,7 +327,8 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
196
327
|
CONSTRAINT fk_mcq_session_questions_session FOREIGN KEY (session_id) REFERENCES mcq_sessions(id) ON DELETE CASCADE,
|
|
197
328
|
CONSTRAINT fk_mcq_session_questions_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE RESTRICT
|
|
198
329
|
)
|
|
199
|
-
|
|
330
|
+
`;
|
|
331
|
+
await tx`
|
|
200
332
|
CREATE TABLE IF NOT EXISTS mcq_session_questions_selected_choices (
|
|
201
333
|
session_question_id VARCHAR(25) NOT NULL,
|
|
202
334
|
choice_id VARCHAR(25) NOT NULL,
|
|
@@ -204,35 +336,73 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
204
336
|
CONSTRAINT fk_mcq_session_questions_selected_choices_session_question FOREIGN KEY (session_question_id) REFERENCES mcq_session_questions(id) ON DELETE CASCADE,
|
|
205
337
|
CONSTRAINT fk_mcq_session_questions_selected_choices_choice FOREIGN KEY (choice_id) REFERENCES mcq_question_choices(id) ON DELETE CASCADE
|
|
206
338
|
)
|
|
207
|
-
|
|
339
|
+
`;
|
|
340
|
+
await tx`
|
|
208
341
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_session_id ON mcq_session_questions(session_id)
|
|
209
|
-
|
|
342
|
+
`;
|
|
343
|
+
await tx`
|
|
210
344
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_question_id ON mcq_session_questions(question_id)
|
|
211
|
-
|
|
345
|
+
`;
|
|
346
|
+
await tx`
|
|
212
347
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_question_number ON mcq_session_questions(question_number)
|
|
213
|
-
|
|
348
|
+
`;
|
|
349
|
+
await tx`
|
|
214
350
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_state ON mcq_session_questions(state)
|
|
215
|
-
|
|
351
|
+
`;
|
|
352
|
+
await tx`
|
|
216
353
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_context ON mcq_session_questions(context, context_id)
|
|
217
|
-
|
|
354
|
+
`;
|
|
355
|
+
await tx`
|
|
218
356
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_score ON mcq_session_questions(score DESC)
|
|
219
|
-
|
|
357
|
+
`;
|
|
358
|
+
await tx`
|
|
220
359
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_language ON mcq_session_questions(language)
|
|
221
|
-
|
|
360
|
+
`;
|
|
361
|
+
await tx`
|
|
222
362
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_deleted_at ON mcq_session_questions(deleted_at)
|
|
223
|
-
|
|
363
|
+
`;
|
|
364
|
+
await tx`
|
|
224
365
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_is_public ON mcq_session_questions(is_public) WHERE deleted_at IS NULL
|
|
225
|
-
|
|
366
|
+
`;
|
|
367
|
+
await tx`
|
|
226
368
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_created_at ON mcq_session_questions(created_at DESC)
|
|
227
|
-
|
|
369
|
+
`;
|
|
370
|
+
await tx`
|
|
228
371
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_active ON mcq_session_questions(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
229
|
-
|
|
372
|
+
`;
|
|
373
|
+
await tx`
|
|
230
374
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_session_question ON mcq_session_questions(session_id, question_number)
|
|
231
|
-
|
|
375
|
+
`;
|
|
376
|
+
await tx`
|
|
232
377
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_selected_choices_session_question_id ON mcq_session_questions_selected_choices(session_question_id)
|
|
233
|
-
|
|
378
|
+
`;
|
|
379
|
+
await tx`
|
|
234
380
|
CREATE INDEX IF NOT EXISTS idx_mcq_session_questions_selected_choices_choice_id ON mcq_session_questions_selected_choices(choice_id)
|
|
235
|
-
|
|
381
|
+
`;
|
|
382
|
+
}
|
|
383
|
+
async down(tx) {
|
|
384
|
+
await tx`DROP TABLE IF EXISTS mcq_session_questions_selected_choices CASCADE`;
|
|
385
|
+
await tx`DROP TABLE IF EXISTS mcq_session_questions CASCADE`;
|
|
386
|
+
await tx`DROP TYPE IF EXISTS answer_state CASCADE`;
|
|
387
|
+
}
|
|
388
|
+
getVersion() {
|
|
389
|
+
return "20251225180910453";
|
|
390
|
+
}
|
|
391
|
+
getDependencies() {
|
|
392
|
+
return [
|
|
393
|
+
Migration20251225180910449,
|
|
394
|
+
Migration20251225180910451
|
|
395
|
+
];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
Migration20251225180910453 = __legacyDecorateClassTS([
|
|
399
|
+
decorator4.migration()
|
|
400
|
+
], Migration20251225180910453);
|
|
401
|
+
// src/migrations/gamification/mcq/Migration20251225180910455.ts
|
|
402
|
+
import { decorator as decorator5 } from "@ooneex/migrations";
|
|
403
|
+
class Migration20251225180910455 {
|
|
404
|
+
async up(tx) {
|
|
405
|
+
await tx`
|
|
236
406
|
CREATE TABLE IF NOT EXISTS mcq_questions_stats (
|
|
237
407
|
id VARCHAR(25) PRIMARY KEY,
|
|
238
408
|
question_id VARCHAR(25),
|
|
@@ -255,25 +425,55 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
255
425
|
deleted_at TIMESTAMPTZ,
|
|
256
426
|
CONSTRAINT fk_mcq_questions_stats_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
257
427
|
)
|
|
258
|
-
|
|
428
|
+
`;
|
|
429
|
+
await tx`
|
|
259
430
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_question_id ON mcq_questions_stats(question_id)
|
|
260
|
-
|
|
431
|
+
`;
|
|
432
|
+
await tx`
|
|
261
433
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_likes_count ON mcq_questions_stats(likes_count DESC)
|
|
262
|
-
|
|
434
|
+
`;
|
|
435
|
+
await tx`
|
|
263
436
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_views_count ON mcq_questions_stats(views_count DESC)
|
|
264
|
-
|
|
437
|
+
`;
|
|
438
|
+
await tx`
|
|
265
439
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_language ON mcq_questions_stats(language)
|
|
266
|
-
|
|
440
|
+
`;
|
|
441
|
+
await tx`
|
|
267
442
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_deleted_at ON mcq_questions_stats(deleted_at)
|
|
268
|
-
|
|
443
|
+
`;
|
|
444
|
+
await tx`
|
|
269
445
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_is_public ON mcq_questions_stats(is_public) WHERE deleted_at IS NULL
|
|
270
|
-
|
|
446
|
+
`;
|
|
447
|
+
await tx`
|
|
271
448
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_popular ON mcq_questions_stats(is_public, likes_count DESC, views_count DESC) WHERE deleted_at IS NULL
|
|
272
|
-
|
|
449
|
+
`;
|
|
450
|
+
await tx`
|
|
273
451
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_created_at ON mcq_questions_stats(created_at DESC)
|
|
274
|
-
|
|
452
|
+
`;
|
|
453
|
+
await tx`
|
|
275
454
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_stats_active ON mcq_questions_stats(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
276
|
-
|
|
455
|
+
`;
|
|
456
|
+
}
|
|
457
|
+
async down(tx) {
|
|
458
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_stats CASCADE`;
|
|
459
|
+
}
|
|
460
|
+
getVersion() {
|
|
461
|
+
return "20251225180910455";
|
|
462
|
+
}
|
|
463
|
+
getDependencies() {
|
|
464
|
+
return [
|
|
465
|
+
Migration20251225180910446
|
|
466
|
+
];
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
Migration20251225180910455 = __legacyDecorateClassTS([
|
|
470
|
+
decorator5.migration()
|
|
471
|
+
], Migration20251225180910455);
|
|
472
|
+
// src/migrations/gamification/mcq/Migration20251225180910458.ts
|
|
473
|
+
import { decorator as decorator6 } from "@ooneex/migrations";
|
|
474
|
+
class Migration20251225180910458 {
|
|
475
|
+
async up(tx) {
|
|
476
|
+
await tx`
|
|
277
477
|
CREATE TABLE IF NOT EXISTS mcq_questions_comments (
|
|
278
478
|
id VARCHAR(25) PRIMARY KEY,
|
|
279
479
|
question_id VARCHAR(25),
|
|
@@ -293,23 +493,52 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
293
493
|
deleted_at TIMESTAMPTZ,
|
|
294
494
|
CONSTRAINT fk_mcq_questions_comments_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
295
495
|
)
|
|
296
|
-
|
|
496
|
+
`;
|
|
497
|
+
await tx`
|
|
297
498
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_question_id ON mcq_questions_comments(question_id)
|
|
298
|
-
|
|
499
|
+
`;
|
|
500
|
+
await tx`
|
|
299
501
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_commented_by_id ON mcq_questions_comments(commented_by_id)
|
|
300
|
-
|
|
502
|
+
`;
|
|
503
|
+
await tx`
|
|
301
504
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_parent_comment_id ON mcq_questions_comments(parent_comment_id)
|
|
302
|
-
|
|
505
|
+
`;
|
|
506
|
+
await tx`
|
|
303
507
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_language ON mcq_questions_comments(language)
|
|
304
|
-
|
|
508
|
+
`;
|
|
509
|
+
await tx`
|
|
305
510
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_deleted_at ON mcq_questions_comments(deleted_at)
|
|
306
|
-
|
|
511
|
+
`;
|
|
512
|
+
await tx`
|
|
307
513
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_is_public ON mcq_questions_comments(is_public) WHERE deleted_at IS NULL
|
|
308
|
-
|
|
514
|
+
`;
|
|
515
|
+
await tx`
|
|
309
516
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_created_at ON mcq_questions_comments(created_at DESC)
|
|
310
|
-
|
|
517
|
+
`;
|
|
518
|
+
await tx`
|
|
311
519
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_comments_active ON mcq_questions_comments(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
312
|
-
|
|
520
|
+
`;
|
|
521
|
+
}
|
|
522
|
+
async down(tx) {
|
|
523
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_comments CASCADE`;
|
|
524
|
+
}
|
|
525
|
+
getVersion() {
|
|
526
|
+
return "20251225180910458";
|
|
527
|
+
}
|
|
528
|
+
getDependencies() {
|
|
529
|
+
return [
|
|
530
|
+
Migration20251225180910446
|
|
531
|
+
];
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
Migration20251225180910458 = __legacyDecorateClassTS([
|
|
535
|
+
decorator6.migration()
|
|
536
|
+
], Migration20251225180910458);
|
|
537
|
+
// src/migrations/gamification/mcq/Migration20251225180910460.ts
|
|
538
|
+
import { decorator as decorator7 } from "@ooneex/migrations";
|
|
539
|
+
class Migration20251225180910460 {
|
|
540
|
+
async up(tx) {
|
|
541
|
+
await tx`
|
|
313
542
|
CREATE TABLE IF NOT EXISTS mcq_questions_liked (
|
|
314
543
|
id VARCHAR(25) PRIMARY KEY,
|
|
315
544
|
question_id VARCHAR(25),
|
|
@@ -327,23 +556,52 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
327
556
|
deleted_at TIMESTAMPTZ,
|
|
328
557
|
CONSTRAINT fk_mcq_questions_liked_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
329
558
|
)
|
|
330
|
-
|
|
559
|
+
`;
|
|
560
|
+
await tx`
|
|
331
561
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_question_id ON mcq_questions_liked(question_id)
|
|
332
|
-
|
|
562
|
+
`;
|
|
563
|
+
await tx`
|
|
333
564
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_liked_by_id ON mcq_questions_liked(liked_by_id)
|
|
334
|
-
|
|
565
|
+
`;
|
|
566
|
+
await tx`
|
|
335
567
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_language ON mcq_questions_liked(language)
|
|
336
|
-
|
|
568
|
+
`;
|
|
569
|
+
await tx`
|
|
337
570
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_deleted_at ON mcq_questions_liked(deleted_at)
|
|
338
|
-
|
|
571
|
+
`;
|
|
572
|
+
await tx`
|
|
339
573
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_is_public ON mcq_questions_liked(is_public) WHERE deleted_at IS NULL
|
|
340
|
-
|
|
574
|
+
`;
|
|
575
|
+
await tx`
|
|
341
576
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_created_at ON mcq_questions_liked(created_at DESC)
|
|
342
|
-
|
|
577
|
+
`;
|
|
578
|
+
await tx`
|
|
343
579
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_liked_active ON mcq_questions_liked(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
344
|
-
|
|
580
|
+
`;
|
|
581
|
+
await tx`
|
|
345
582
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_mcq_questions_liked_unique ON mcq_questions_liked(question_id, liked_by_id) WHERE deleted_at IS NULL
|
|
346
|
-
|
|
583
|
+
`;
|
|
584
|
+
}
|
|
585
|
+
async down(tx) {
|
|
586
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_liked CASCADE`;
|
|
587
|
+
}
|
|
588
|
+
getVersion() {
|
|
589
|
+
return "20251225180910460";
|
|
590
|
+
}
|
|
591
|
+
getDependencies() {
|
|
592
|
+
return [
|
|
593
|
+
Migration20251225180910446
|
|
594
|
+
];
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
Migration20251225180910460 = __legacyDecorateClassTS([
|
|
598
|
+
decorator7.migration()
|
|
599
|
+
], Migration20251225180910460);
|
|
600
|
+
// src/migrations/gamification/mcq/Migration20251225180910462.ts
|
|
601
|
+
import { decorator as decorator8 } from "@ooneex/migrations";
|
|
602
|
+
class Migration20251225180910462 {
|
|
603
|
+
async up(tx) {
|
|
604
|
+
await tx`
|
|
347
605
|
CREATE TABLE IF NOT EXISTS mcq_questions_disliked (
|
|
348
606
|
id VARCHAR(25) PRIMARY KEY,
|
|
349
607
|
question_id VARCHAR(25),
|
|
@@ -361,23 +619,52 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
361
619
|
deleted_at TIMESTAMPTZ,
|
|
362
620
|
CONSTRAINT fk_mcq_questions_disliked_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
363
621
|
)
|
|
364
|
-
|
|
622
|
+
`;
|
|
623
|
+
await tx`
|
|
365
624
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_question_id ON mcq_questions_disliked(question_id)
|
|
366
|
-
|
|
625
|
+
`;
|
|
626
|
+
await tx`
|
|
367
627
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_disliked_by_id ON mcq_questions_disliked(disliked_by_id)
|
|
368
|
-
|
|
628
|
+
`;
|
|
629
|
+
await tx`
|
|
369
630
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_language ON mcq_questions_disliked(language)
|
|
370
|
-
|
|
631
|
+
`;
|
|
632
|
+
await tx`
|
|
371
633
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_deleted_at ON mcq_questions_disliked(deleted_at)
|
|
372
|
-
|
|
634
|
+
`;
|
|
635
|
+
await tx`
|
|
373
636
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_is_public ON mcq_questions_disliked(is_public) WHERE deleted_at IS NULL
|
|
374
|
-
|
|
637
|
+
`;
|
|
638
|
+
await tx`
|
|
375
639
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_created_at ON mcq_questions_disliked(created_at DESC)
|
|
376
|
-
|
|
640
|
+
`;
|
|
641
|
+
await tx`
|
|
377
642
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_disliked_active ON mcq_questions_disliked(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
378
|
-
|
|
643
|
+
`;
|
|
644
|
+
await tx`
|
|
379
645
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_mcq_questions_disliked_unique ON mcq_questions_disliked(question_id, disliked_by_id) WHERE deleted_at IS NULL
|
|
380
|
-
|
|
646
|
+
`;
|
|
647
|
+
}
|
|
648
|
+
async down(tx) {
|
|
649
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_disliked CASCADE`;
|
|
650
|
+
}
|
|
651
|
+
getVersion() {
|
|
652
|
+
return "20251225180910462";
|
|
653
|
+
}
|
|
654
|
+
getDependencies() {
|
|
655
|
+
return [
|
|
656
|
+
Migration20251225180910446
|
|
657
|
+
];
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
Migration20251225180910462 = __legacyDecorateClassTS([
|
|
661
|
+
decorator8.migration()
|
|
662
|
+
], Migration20251225180910462);
|
|
663
|
+
// src/migrations/gamification/mcq/Migration20251225180910465.ts
|
|
664
|
+
import { decorator as decorator9 } from "@ooneex/migrations";
|
|
665
|
+
class Migration20251225180910465 {
|
|
666
|
+
async up(tx) {
|
|
667
|
+
await tx`
|
|
381
668
|
CREATE TABLE IF NOT EXISTS mcq_questions_viewed (
|
|
382
669
|
id VARCHAR(25) PRIMARY KEY,
|
|
383
670
|
question_id VARCHAR(25),
|
|
@@ -395,21 +682,49 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
395
682
|
deleted_at TIMESTAMPTZ,
|
|
396
683
|
CONSTRAINT fk_mcq_questions_viewed_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
397
684
|
)
|
|
398
|
-
|
|
685
|
+
`;
|
|
686
|
+
await tx`
|
|
399
687
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_question_id ON mcq_questions_viewed(question_id)
|
|
400
|
-
|
|
688
|
+
`;
|
|
689
|
+
await tx`
|
|
401
690
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_viewed_by_id ON mcq_questions_viewed(viewed_by_id)
|
|
402
|
-
|
|
691
|
+
`;
|
|
692
|
+
await tx`
|
|
403
693
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_language ON mcq_questions_viewed(language)
|
|
404
|
-
|
|
694
|
+
`;
|
|
695
|
+
await tx`
|
|
405
696
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_deleted_at ON mcq_questions_viewed(deleted_at)
|
|
406
|
-
|
|
697
|
+
`;
|
|
698
|
+
await tx`
|
|
407
699
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_is_public ON mcq_questions_viewed(is_public) WHERE deleted_at IS NULL
|
|
408
|
-
|
|
700
|
+
`;
|
|
701
|
+
await tx`
|
|
409
702
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_created_at ON mcq_questions_viewed(created_at DESC)
|
|
410
|
-
|
|
703
|
+
`;
|
|
704
|
+
await tx`
|
|
411
705
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_viewed_active ON mcq_questions_viewed(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
412
|
-
|
|
706
|
+
`;
|
|
707
|
+
}
|
|
708
|
+
async down(tx) {
|
|
709
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_viewed CASCADE`;
|
|
710
|
+
}
|
|
711
|
+
getVersion() {
|
|
712
|
+
return "20251225180910465";
|
|
713
|
+
}
|
|
714
|
+
getDependencies() {
|
|
715
|
+
return [
|
|
716
|
+
Migration20251225180910446
|
|
717
|
+
];
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
Migration20251225180910465 = __legacyDecorateClassTS([
|
|
721
|
+
decorator9.migration()
|
|
722
|
+
], Migration20251225180910465);
|
|
723
|
+
// src/migrations/gamification/mcq/Migration20251225180910467.ts
|
|
724
|
+
import { decorator as decorator10 } from "@ooneex/migrations";
|
|
725
|
+
class Migration20251225180910467 {
|
|
726
|
+
async up(tx) {
|
|
727
|
+
await tx`
|
|
413
728
|
CREATE TABLE IF NOT EXISTS mcq_questions_saved (
|
|
414
729
|
id VARCHAR(25) PRIMARY KEY,
|
|
415
730
|
question_id VARCHAR(25),
|
|
@@ -427,23 +742,52 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
427
742
|
deleted_at TIMESTAMPTZ,
|
|
428
743
|
CONSTRAINT fk_mcq_questions_saved_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
429
744
|
)
|
|
430
|
-
|
|
745
|
+
`;
|
|
746
|
+
await tx`
|
|
431
747
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_question_id ON mcq_questions_saved(question_id)
|
|
432
|
-
|
|
748
|
+
`;
|
|
749
|
+
await tx`
|
|
433
750
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_saved_by_id ON mcq_questions_saved(saved_by_id)
|
|
434
|
-
|
|
751
|
+
`;
|
|
752
|
+
await tx`
|
|
435
753
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_language ON mcq_questions_saved(language)
|
|
436
|
-
|
|
754
|
+
`;
|
|
755
|
+
await tx`
|
|
437
756
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_deleted_at ON mcq_questions_saved(deleted_at)
|
|
438
|
-
|
|
757
|
+
`;
|
|
758
|
+
await tx`
|
|
439
759
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_is_public ON mcq_questions_saved(is_public) WHERE deleted_at IS NULL
|
|
440
|
-
|
|
760
|
+
`;
|
|
761
|
+
await tx`
|
|
441
762
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_created_at ON mcq_questions_saved(created_at DESC)
|
|
442
|
-
|
|
763
|
+
`;
|
|
764
|
+
await tx`
|
|
443
765
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_saved_active ON mcq_questions_saved(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
444
|
-
|
|
766
|
+
`;
|
|
767
|
+
await tx`
|
|
445
768
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_mcq_questions_saved_unique ON mcq_questions_saved(question_id, saved_by_id) WHERE deleted_at IS NULL
|
|
446
|
-
|
|
769
|
+
`;
|
|
770
|
+
}
|
|
771
|
+
async down(tx) {
|
|
772
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_saved CASCADE`;
|
|
773
|
+
}
|
|
774
|
+
getVersion() {
|
|
775
|
+
return "20251225180910467";
|
|
776
|
+
}
|
|
777
|
+
getDependencies() {
|
|
778
|
+
return [
|
|
779
|
+
Migration20251225180910446
|
|
780
|
+
];
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
Migration20251225180910467 = __legacyDecorateClassTS([
|
|
784
|
+
decorator10.migration()
|
|
785
|
+
], Migration20251225180910467);
|
|
786
|
+
// src/migrations/gamification/mcq/Migration20251225180910469.ts
|
|
787
|
+
import { decorator as decorator11 } from "@ooneex/migrations";
|
|
788
|
+
class Migration20251225180910469 {
|
|
789
|
+
async up(tx) {
|
|
790
|
+
await tx`
|
|
447
791
|
CREATE TABLE IF NOT EXISTS mcq_questions_shared (
|
|
448
792
|
id VARCHAR(25) PRIMARY KEY,
|
|
449
793
|
question_id VARCHAR(25),
|
|
@@ -463,25 +807,55 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
463
807
|
deleted_at TIMESTAMPTZ,
|
|
464
808
|
CONSTRAINT fk_mcq_questions_shared_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE
|
|
465
809
|
)
|
|
466
|
-
|
|
810
|
+
`;
|
|
811
|
+
await tx`
|
|
467
812
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_question_id ON mcq_questions_shared(question_id)
|
|
468
|
-
|
|
813
|
+
`;
|
|
814
|
+
await tx`
|
|
469
815
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_shared_by_id ON mcq_questions_shared(shared_by_id)
|
|
470
|
-
|
|
816
|
+
`;
|
|
817
|
+
await tx`
|
|
471
818
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_expires_at ON mcq_questions_shared(expires_at)
|
|
472
|
-
|
|
819
|
+
`;
|
|
820
|
+
await tx`
|
|
473
821
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_language ON mcq_questions_shared(language)
|
|
474
|
-
|
|
822
|
+
`;
|
|
823
|
+
await tx`
|
|
475
824
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_deleted_at ON mcq_questions_shared(deleted_at)
|
|
476
|
-
|
|
825
|
+
`;
|
|
826
|
+
await tx`
|
|
477
827
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_is_public ON mcq_questions_shared(is_public) WHERE deleted_at IS NULL
|
|
478
|
-
|
|
828
|
+
`;
|
|
829
|
+
await tx`
|
|
479
830
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_created_at ON mcq_questions_shared(created_at DESC)
|
|
480
|
-
|
|
831
|
+
`;
|
|
832
|
+
await tx`
|
|
481
833
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_active ON mcq_questions_shared(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
482
|
-
|
|
834
|
+
`;
|
|
835
|
+
await tx`
|
|
483
836
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_shared_active_shares ON mcq_questions_shared(expires_at) WHERE deleted_at IS NULL AND (expires_at IS NULL OR expires_at > CURRENT_TIMESTAMP)
|
|
484
|
-
|
|
837
|
+
`;
|
|
838
|
+
}
|
|
839
|
+
async down(tx) {
|
|
840
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_shared CASCADE`;
|
|
841
|
+
}
|
|
842
|
+
getVersion() {
|
|
843
|
+
return "20251225180910469";
|
|
844
|
+
}
|
|
845
|
+
getDependencies() {
|
|
846
|
+
return [
|
|
847
|
+
Migration20251225180910446
|
|
848
|
+
];
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
Migration20251225180910469 = __legacyDecorateClassTS([
|
|
852
|
+
decorator11.migration()
|
|
853
|
+
], Migration20251225180910469);
|
|
854
|
+
// src/migrations/gamification/mcq/Migration20251225180910472.ts
|
|
855
|
+
import { decorator as decorator12 } from "@ooneex/migrations";
|
|
856
|
+
class Migration20251225180910472 {
|
|
857
|
+
async up(tx) {
|
|
858
|
+
await tx`
|
|
485
859
|
CREATE TABLE IF NOT EXISTS mcq_questions_reports (
|
|
486
860
|
id VARCHAR(25) PRIMARY KEY,
|
|
487
861
|
question_id VARCHAR(25),
|
|
@@ -503,24 +877,64 @@ import{c as N}from"../../../../shared/chunk-aj0aak90.js";import{e as B}from"../.
|
|
|
503
877
|
CONSTRAINT fk_mcq_questions_reports_question FOREIGN KEY (question_id) REFERENCES mcq_questions(id) ON DELETE CASCADE,
|
|
504
878
|
CONSTRAINT fk_mcq_questions_reports_status FOREIGN KEY (status_id) REFERENCES statuses(id) ON DELETE SET NULL
|
|
505
879
|
)
|
|
506
|
-
|
|
880
|
+
`;
|
|
881
|
+
await tx`
|
|
507
882
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_question_id ON mcq_questions_reports(question_id)
|
|
508
|
-
|
|
883
|
+
`;
|
|
884
|
+
await tx`
|
|
509
885
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_reported_by_id ON mcq_questions_reports(reported_by_id)
|
|
510
|
-
|
|
886
|
+
`;
|
|
887
|
+
await tx`
|
|
511
888
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_status_id ON mcq_questions_reports(status_id)
|
|
512
|
-
|
|
889
|
+
`;
|
|
890
|
+
await tx`
|
|
513
891
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_reason ON mcq_questions_reports(reason)
|
|
514
|
-
|
|
892
|
+
`;
|
|
893
|
+
await tx`
|
|
515
894
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_language ON mcq_questions_reports(language)
|
|
516
|
-
|
|
895
|
+
`;
|
|
896
|
+
await tx`
|
|
517
897
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_deleted_at ON mcq_questions_reports(deleted_at)
|
|
518
|
-
|
|
898
|
+
`;
|
|
899
|
+
await tx`
|
|
519
900
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_is_public ON mcq_questions_reports(is_public) WHERE deleted_at IS NULL
|
|
520
|
-
|
|
901
|
+
`;
|
|
902
|
+
await tx`
|
|
521
903
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_created_at ON mcq_questions_reports(created_at DESC)
|
|
522
|
-
|
|
904
|
+
`;
|
|
905
|
+
await tx`
|
|
523
906
|
CREATE INDEX IF NOT EXISTS idx_mcq_questions_reports_active ON mcq_questions_reports(is_blocked, is_locked) WHERE deleted_at IS NULL AND is_blocked = false
|
|
524
|
-
|
|
907
|
+
`;
|
|
908
|
+
}
|
|
909
|
+
async down(tx) {
|
|
910
|
+
await tx`DROP TABLE IF EXISTS mcq_questions_reports CASCADE`;
|
|
911
|
+
}
|
|
912
|
+
getVersion() {
|
|
913
|
+
return "20251225180910472";
|
|
914
|
+
}
|
|
915
|
+
getDependencies() {
|
|
916
|
+
return [
|
|
917
|
+
Migration20251225180910446,
|
|
918
|
+
Migration20251225173350644
|
|
919
|
+
];
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
Migration20251225180910472 = __legacyDecorateClassTS([
|
|
923
|
+
decorator12.migration()
|
|
924
|
+
], Migration20251225180910472);
|
|
925
|
+
export {
|
|
926
|
+
Migration20251225180910472,
|
|
927
|
+
Migration20251225180910469,
|
|
928
|
+
Migration20251225180910467,
|
|
929
|
+
Migration20251225180910465,
|
|
930
|
+
Migration20251225180910462,
|
|
931
|
+
Migration20251225180910460,
|
|
932
|
+
Migration20251225180910458,
|
|
933
|
+
Migration20251225180910455,
|
|
934
|
+
Migration20251225180910453,
|
|
935
|
+
Migration20251225180910451,
|
|
936
|
+
Migration20251225180910449,
|
|
937
|
+
Migration20251225180910446
|
|
938
|
+
};
|
|
525
939
|
|
|
526
|
-
//# debugId=
|
|
940
|
+
//# debugId=7CA8F2F04D78139864756E2164756E21
|