@trafficgroup/knex-rel 0.0.29 → 0.1.1
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/dao/VideoMinuteResultDAO.d.ts +101 -0
- package/dist/dao/VideoMinuteResultDAO.js +366 -0
- package/dist/dao/VideoMinuteResultDAO.js.map +1 -1
- package/dist/dao/camera/camera.dao.d.ts +13 -0
- package/dist/dao/camera/camera.dao.js +93 -0
- package/dist/dao/camera/camera.dao.js.map +1 -0
- package/dist/dao/video/video.dao.d.ts +5 -0
- package/dist/dao/video/video.dao.js +46 -0
- package/dist/dao/video/video.dao.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/interfaces/camera/camera.interfaces.d.ts +9 -0
- package/dist/interfaces/camera/camera.interfaces.js +3 -0
- package/dist/interfaces/camera/camera.interfaces.js.map +1 -0
- package/dist/interfaces/folder/folder.interfaces.d.ts +3 -0
- package/dist/interfaces/video/video.interfaces.d.ts +8 -0
- package/migrations/20250910015452_migration.ts +34 -0
- package/migrations/20250911000000_migration.ts +61 -0
- package/migrations/20250917144153_migration.ts +37 -0
- package/package.json +1 -1
- package/plan.md +90 -265
- package/src/dao/VideoMinuteResultDAO.ts +517 -0
- package/src/dao/camera/camera.dao.ts +79 -0
- package/src/dao/video/video.dao.ts +49 -0
- package/src/index.ts +12 -10
- package/src/interfaces/camera/camera.interfaces.ts +9 -0
- package/src/interfaces/folder/folder.interfaces.ts +3 -0
- package/src/interfaces/video/video.interfaces.ts +13 -0
|
@@ -166,6 +166,52 @@ class VideoDAO {
|
|
|
166
166
|
};
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Get videos from same folder with same type that have metadata and are COMPLETED
|
|
171
|
+
* Suitable for use as lane annotation templates
|
|
172
|
+
*/
|
|
173
|
+
getTemplateVideos(folderId, videoType) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
try {
|
|
176
|
+
let query = this._knex("video")
|
|
177
|
+
.where("folderId", folderId)
|
|
178
|
+
.where("videoType", videoType)
|
|
179
|
+
.where("status", "COMPLETED")
|
|
180
|
+
.whereNotNull("metadata")
|
|
181
|
+
.whereRaw("metadata != '{}'");
|
|
182
|
+
// Apply video type specific metadata validation
|
|
183
|
+
if (videoType === "ATR") {
|
|
184
|
+
// ATR videos use lanes array structure
|
|
185
|
+
query = query.whereRaw("jsonb_array_length(metadata->'lanes') > 0");
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// TMC/JUNCTION/ROUNDABOUT/PATHWAY videos use objects with pt1/pt2 structure
|
|
189
|
+
// Check if metadata has at least one key with pt1 and pt2 properties
|
|
190
|
+
query = query.whereRaw(`
|
|
191
|
+
EXISTS (
|
|
192
|
+
SELECT 1
|
|
193
|
+
FROM jsonb_each(metadata) as entry(key, value)
|
|
194
|
+
WHERE key != 'lanes'
|
|
195
|
+
AND key != 'finish_line'
|
|
196
|
+
AND jsonb_typeof(value) = 'object'
|
|
197
|
+
AND value ? 'pt1'
|
|
198
|
+
AND value ? 'pt2'
|
|
199
|
+
AND jsonb_typeof(value->'pt1') = 'array'
|
|
200
|
+
AND jsonb_typeof(value->'pt2') = 'array'
|
|
201
|
+
AND jsonb_array_length(value->'pt1') = 2
|
|
202
|
+
AND jsonb_array_length(value->'pt2') = 2
|
|
203
|
+
)
|
|
204
|
+
`);
|
|
205
|
+
}
|
|
206
|
+
const videos = yield query.orderBy("updated_at", "desc").select("*");
|
|
207
|
+
return videos;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
console.error("Error fetching template videos:", error);
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
169
215
|
}
|
|
170
216
|
exports.VideoDAO = VideoDAO;
|
|
171
217
|
//# sourceMappingURL=video.dao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;IAiPpE,CAAC;IA/OC,MAAM,CAAC,WAAW;QAChB,OAAO,wBAAW,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAEK,MAAM,CAAC,IAAY;;YACvB,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;iBAC7C,MAAM,CAAC,IAAI,CAAC;iBACZ,SAAS,CAAC,GAAG,CAAC,CAAC;YAClB,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAEK,OAAO,CAAC,EAAU;;YACtB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;iBACzC,SAAS,CAAC,cAAc,EAAE,YAAY,EAAE,MAAM,CAAC;iBAC/C,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;iBACxD,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;iBACjB,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,IAAI,IAAI,CAAC;QACvB,CAAC;KAAA;IAEK,SAAS,CAAC,IAAY;;YAC1B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;iBACzC,SAAS,CAAC,cAAc,EAAE,YAAY,EAAE,MAAM,CAAC;iBAC/C,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC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AK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;qBAC5B,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC;qBAC3B,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC;qBAC7B,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC;qBAC5B,YAAY,CAAC,UAAU,CAAC;qBACxB,QAAQ,CAAC,kBAAkB,CAAC,CAAC;gBAEhC,gDAAgD;gBAChD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;oBACxB,uCAAuC;oBACvC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,2CAA2C,CAAC,CAAC;gBACtE,CAAC;qBAAM,CAAC;oBACN,4EAA4E;oBAC5E,qEAAqE;oBACrE,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;iBAcd,CAAC,CAAC;gBACb,CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAErE,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;gBACxD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF;AAlPD,4BAkPC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
export { UserDAO } from "./dao/user/user.dao";
|
|
2
|
-
export { StudyDAO } from "./dao/study/study.dao";
|
|
3
|
-
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
4
|
-
export { VideoDAO } from "./dao/video/video.dao";
|
|
5
1
|
export { AuthDAO } from "./dao/auth/auth.dao";
|
|
6
|
-
export {
|
|
2
|
+
export { CameraDAO } from "./dao/camera/camera.dao";
|
|
7
3
|
export { ChatDAO } from "./dao/chat/chat.dao";
|
|
4
|
+
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
8
5
|
export { MessageDAO } from "./dao/message/message.dao";
|
|
6
|
+
export { StudyDAO } from "./dao/study/study.dao";
|
|
7
|
+
export { UserDAO } from "./dao/user/user.dao";
|
|
8
|
+
export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token/user-push-notification-token.dao";
|
|
9
|
+
export { VideoDAO } from "./dao/video/video.dao";
|
|
9
10
|
export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
|
|
10
11
|
export { IDataPaginator } from "./d.types";
|
|
11
|
-
export { IUser } from "./interfaces/user/user.interfaces";
|
|
12
|
-
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
13
|
-
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
14
|
-
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
15
12
|
export { IAuth } from "./interfaces/auth/auth.interfaces";
|
|
16
|
-
export {
|
|
13
|
+
export { ICamera } from "./interfaces/camera/camera.interfaces";
|
|
17
14
|
export { IChat, IChatCreate, IChatUpdate, } from "./interfaces/chat/chat.interfaces";
|
|
15
|
+
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
18
16
|
export { IMessage, IMessageCreate, IMessageUpdate, } from "./interfaces/message/message.interfaces";
|
|
17
|
+
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
18
|
+
export { IUser } from "./interfaces/user/user.interfaces";
|
|
19
|
+
export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
|
|
20
|
+
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
19
21
|
export { IVideoMinuteResult, IVideoMinuteResultInput, IVideoMinuteBatch, } from "./entities/VideoMinuteResult";
|
|
20
22
|
import KnexManager from "./KnexConnection";
|
|
21
23
|
export { KnexManager };
|
package/dist/index.js
CHANGED
|
@@ -3,24 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.KnexManager = exports.VideoMinuteResultDAO = exports.
|
|
6
|
+
exports.KnexManager = exports.VideoMinuteResultDAO = exports.VideoDAO = exports.UserPushNotificationTokenDAO = exports.UserDAO = exports.StudyDAO = exports.MessageDAO = exports.FolderDAO = exports.ChatDAO = exports.CameraDAO = exports.AuthDAO = void 0;
|
|
7
7
|
// DAOs
|
|
8
|
-
var user_dao_1 = require("./dao/user/user.dao");
|
|
9
|
-
Object.defineProperty(exports, "UserDAO", { enumerable: true, get: function () { return user_dao_1.UserDAO; } });
|
|
10
|
-
var study_dao_1 = require("./dao/study/study.dao");
|
|
11
|
-
Object.defineProperty(exports, "StudyDAO", { enumerable: true, get: function () { return study_dao_1.StudyDAO; } });
|
|
12
|
-
var folder_dao_1 = require("./dao/folder/folder.dao");
|
|
13
|
-
Object.defineProperty(exports, "FolderDAO", { enumerable: true, get: function () { return folder_dao_1.FolderDAO; } });
|
|
14
|
-
var video_dao_1 = require("./dao/video/video.dao");
|
|
15
|
-
Object.defineProperty(exports, "VideoDAO", { enumerable: true, get: function () { return video_dao_1.VideoDAO; } });
|
|
16
8
|
var auth_dao_1 = require("./dao/auth/auth.dao");
|
|
17
9
|
Object.defineProperty(exports, "AuthDAO", { enumerable: true, get: function () { return auth_dao_1.AuthDAO; } });
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var camera_dao_1 = require("./dao/camera/camera.dao");
|
|
11
|
+
Object.defineProperty(exports, "CameraDAO", { enumerable: true, get: function () { return camera_dao_1.CameraDAO; } });
|
|
20
12
|
var chat_dao_1 = require("./dao/chat/chat.dao");
|
|
21
13
|
Object.defineProperty(exports, "ChatDAO", { enumerable: true, get: function () { return chat_dao_1.ChatDAO; } });
|
|
14
|
+
var folder_dao_1 = require("./dao/folder/folder.dao");
|
|
15
|
+
Object.defineProperty(exports, "FolderDAO", { enumerable: true, get: function () { return folder_dao_1.FolderDAO; } });
|
|
22
16
|
var message_dao_1 = require("./dao/message/message.dao");
|
|
23
17
|
Object.defineProperty(exports, "MessageDAO", { enumerable: true, get: function () { return message_dao_1.MessageDAO; } });
|
|
18
|
+
var study_dao_1 = require("./dao/study/study.dao");
|
|
19
|
+
Object.defineProperty(exports, "StudyDAO", { enumerable: true, get: function () { return study_dao_1.StudyDAO; } });
|
|
20
|
+
var user_dao_1 = require("./dao/user/user.dao");
|
|
21
|
+
Object.defineProperty(exports, "UserDAO", { enumerable: true, get: function () { return user_dao_1.UserDAO; } });
|
|
22
|
+
var user_push_notification_token_dao_1 = require("./dao/user-push-notification-token/user-push-notification-token.dao");
|
|
23
|
+
Object.defineProperty(exports, "UserPushNotificationTokenDAO", { enumerable: true, get: function () { return user_push_notification_token_dao_1.UserPushNotificationTokenDAO; } });
|
|
24
|
+
var video_dao_1 = require("./dao/video/video.dao");
|
|
25
|
+
Object.defineProperty(exports, "VideoDAO", { enumerable: true, get: function () { return video_dao_1.VideoDAO; } });
|
|
24
26
|
var VideoMinuteResultDAO_1 = require("./dao/VideoMinuteResultDAO");
|
|
25
27
|
Object.defineProperty(exports, "VideoMinuteResultDAO", { enumerable: true, get: function () { return VideoMinuteResultDAO_1.VideoMinuteResultDAO; } });
|
|
26
28
|
const KnexConnection_1 = __importDefault(require("./KnexConnection"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,wHAAmH;AAA1G,gJAAA,4BAA4B,OAAA;AACrC,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,mEAAkE;AAAzD,4HAAA,oBAAoB,OAAA;AA2B7B,sEAA2C;AAClC,sBADF,wBAAW,CACE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/camera/camera.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IStudy } from "../study/study.interfaces";
|
|
2
|
+
import type { ICamera } from "../camera/camera.interfaces";
|
|
2
3
|
export interface IFolder {
|
|
3
4
|
id: number;
|
|
4
5
|
uuid: string;
|
|
@@ -6,7 +7,9 @@ export interface IFolder {
|
|
|
6
7
|
createdBy: number;
|
|
7
8
|
status: "UPLOADING" | "COMPLETE";
|
|
8
9
|
studyId: number;
|
|
10
|
+
cameraId?: number;
|
|
9
11
|
created_at: string;
|
|
10
12
|
updated_at: string;
|
|
11
13
|
study?: IStudy;
|
|
14
|
+
camera?: ICamera;
|
|
12
15
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
+
import type { ICamera } from "../camera/camera.interfaces";
|
|
2
3
|
export interface IVideo {
|
|
3
4
|
id: number;
|
|
4
5
|
uuid: string;
|
|
5
6
|
folderId: number;
|
|
7
|
+
cameraId?: number;
|
|
8
|
+
annotationSourceId?: number;
|
|
6
9
|
name: string;
|
|
7
10
|
videoLocation: string;
|
|
8
11
|
videoOutputLocation: string | null;
|
|
@@ -15,7 +18,12 @@ export interface IVideo {
|
|
|
15
18
|
remainingTime: string;
|
|
16
19
|
results: Record<string, any>;
|
|
17
20
|
durationSeconds?: number;
|
|
21
|
+
isHlsEnabled: boolean;
|
|
22
|
+
hlsPlaylist: string | null;
|
|
23
|
+
videoSizeMB: number | null;
|
|
24
|
+
streamingMetadata: Record<string, any> | null;
|
|
18
25
|
created_at: string;
|
|
19
26
|
updated_at: string;
|
|
20
27
|
folder?: IFolder;
|
|
28
|
+
camera?: ICamera;
|
|
21
29
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Knex } from "knex";
|
|
2
|
+
|
|
3
|
+
export async function up(knex: Knex): Promise<void> {
|
|
4
|
+
await knex.schema.alterTable("video", (table) => {
|
|
5
|
+
table
|
|
6
|
+
.boolean("isHlsEnabled")
|
|
7
|
+
.defaultTo(false)
|
|
8
|
+
.comment("Whether HLS streaming is enabled for this video");
|
|
9
|
+
table
|
|
10
|
+
.text("hlsPlaylist")
|
|
11
|
+
.nullable()
|
|
12
|
+
.comment("S3 path to the HLS master playlist file");
|
|
13
|
+
table
|
|
14
|
+
.decimal("videoSizeMB", 12, 2)
|
|
15
|
+
.nullable()
|
|
16
|
+
.comment("Final processed video size in MB");
|
|
17
|
+
|
|
18
|
+
table
|
|
19
|
+
.json("streamingMetadata")
|
|
20
|
+
.nullable()
|
|
21
|
+
.comment(
|
|
22
|
+
"Additional streaming metadata (quality levels, segment info, etc.)",
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function down(knex: Knex): Promise<void> {
|
|
28
|
+
await knex.schema.alterTable("video", (table) => {
|
|
29
|
+
table.dropColumn("isHlsEnabled");
|
|
30
|
+
table.dropColumn("hlsPlaylist");
|
|
31
|
+
table.dropColumn("videoSizeMB");
|
|
32
|
+
table.dropColumn("streamingMetadata");
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Knex } from "knex";
|
|
2
|
+
|
|
3
|
+
export async function up(knex: Knex): Promise<void> {
|
|
4
|
+
// Create cameras table
|
|
5
|
+
await knex.schema.createTable("cameras", (table) => {
|
|
6
|
+
table.increments("id").primary();
|
|
7
|
+
table
|
|
8
|
+
.uuid("uuid")
|
|
9
|
+
.defaultTo(knex.raw("uuid_generate_v4()"))
|
|
10
|
+
.notNullable()
|
|
11
|
+
.unique();
|
|
12
|
+
table.string("name", 100).notNullable();
|
|
13
|
+
table.decimal("longitude", 10, 7).notNullable();
|
|
14
|
+
table.decimal("latitude", 10, 7).notNullable();
|
|
15
|
+
table.timestamps(true, true);
|
|
16
|
+
|
|
17
|
+
table.index(["uuid"]);
|
|
18
|
+
table.index(["longitude", "latitude"]);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Add cameraId to videos table
|
|
22
|
+
await knex.schema.alterTable("video", (table) => {
|
|
23
|
+
table
|
|
24
|
+
.integer("cameraId")
|
|
25
|
+
.nullable()
|
|
26
|
+
.references("id")
|
|
27
|
+
.inTable("cameras")
|
|
28
|
+
.onDelete("SET NULL");
|
|
29
|
+
table.index(["cameraId"]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Add cameraId to folders table
|
|
33
|
+
await knex.schema.alterTable("folders", (table) => {
|
|
34
|
+
table
|
|
35
|
+
.integer("cameraId")
|
|
36
|
+
.nullable()
|
|
37
|
+
.references("id")
|
|
38
|
+
.inTable("cameras")
|
|
39
|
+
.onDelete("SET NULL");
|
|
40
|
+
table.index(["cameraId"]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function down(knex: Knex): Promise<void> {
|
|
45
|
+
// Remove cameraId from folders table
|
|
46
|
+
await knex.schema.alterTable("folders", (table) => {
|
|
47
|
+
table.dropIndex(["cameraId"]);
|
|
48
|
+
table.dropForeign(["cameraId"]);
|
|
49
|
+
table.dropColumn("cameraId");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Remove cameraId from videos table
|
|
53
|
+
await knex.schema.alterTable("video", (table) => {
|
|
54
|
+
table.dropIndex(["cameraId"]);
|
|
55
|
+
table.dropForeign(["cameraId"]);
|
|
56
|
+
table.dropColumn("cameraId");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Drop cameras table
|
|
60
|
+
await knex.schema.dropTable("cameras");
|
|
61
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Knex } from "knex";
|
|
2
|
+
|
|
3
|
+
export async function up(knex: Knex): Promise<void> {
|
|
4
|
+
await knex.schema.alterTable("video", (table) => {
|
|
5
|
+
// Add annotationSourceId column with foreign key to video table
|
|
6
|
+
table
|
|
7
|
+
.integer("annotationSourceId")
|
|
8
|
+
.nullable()
|
|
9
|
+
.references("id")
|
|
10
|
+
.inTable("video")
|
|
11
|
+
.onDelete("SET NULL");
|
|
12
|
+
|
|
13
|
+
// Add index for performance when querying by annotation source
|
|
14
|
+
table.index(["annotationSourceId"], "idx_video_annotation_source_id");
|
|
15
|
+
|
|
16
|
+
// Add composite index for efficient template lookups
|
|
17
|
+
table.index(
|
|
18
|
+
["folderId", "videoType", "status"],
|
|
19
|
+
"idx_video_template_lookup",
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function down(knex: Knex): Promise<void> {
|
|
25
|
+
await knex.schema.alterTable("video", (table) => {
|
|
26
|
+
// Drop indexes first
|
|
27
|
+
table.dropIndex(
|
|
28
|
+
["folderId", "videoType", "status"],
|
|
29
|
+
"idx_video_template_lookup",
|
|
30
|
+
);
|
|
31
|
+
table.dropIndex(["annotationSourceId"], "idx_video_annotation_source_id");
|
|
32
|
+
|
|
33
|
+
// Drop foreign key and column
|
|
34
|
+
table.dropForeign(["annotationSourceId"]);
|
|
35
|
+
table.dropColumn("annotationSourceId");
|
|
36
|
+
});
|
|
37
|
+
}
|