fix: confirm module shutdown before disconnect or release

This commit is contained in:
2026-08-04 13:11:26 +09:00
parent b7e910dcf7
commit e06b853bcb
8 changed files with 506 additions and 3 deletions
@@ -0,0 +1,31 @@
DO $$
DECLARE
target record;
BEGIN
FOR target IN
SELECT * FROM (VALUES
('student_enrollments', 'created_at'),
('student_enrollments', 'updated_at'),
('student_enrollments', 'removed_at'),
('student_groups', 'created_at'),
('student_groups', 'updated_at'),
('student_group_members', 'created_at')
) AS targets(table_name, column_name)
LOOP
IF EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = target.table_name
AND column_name = target.column_name
AND data_type = 'timestamp without time zone'
) THEN
EXECUTE format(
'ALTER TABLE %I ALTER COLUMN %I TYPE TIMESTAMPTZ(3) USING %I AT TIME ZONE ''UTC''',
target.table_name,
target.column_name,
target.column_name
);
END IF;
END LOOP;
END $$;
@@ -0,0 +1,31 @@
CREATE TABLE "student_custom_modules" (
"id" UUID NOT NULL,
"user_id" UUID NOT NULL,
"course_id" UUID NOT NULL,
"week" INTEGER NOT NULL,
"sort_order" INTEGER NOT NULL,
"category" TEXT NOT NULL,
"name" TEXT NOT NULL,
"folder_name" TEXT NOT NULL,
"docker_image" TEXT,
"package_name" TEXT NOT NULL,
"launch_file" TEXT NOT NULL,
"created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMPTZ(3) NOT NULL,
CONSTRAINT "student_custom_modules_pkey" PRIMARY KEY ("id")
);
CREATE UNIQUE INDEX "student_custom_modules_user_id_course_id_week_folder_name_key"
ON "student_custom_modules"("user_id", "course_id", "week", "folder_name");
CREATE INDEX "student_custom_modules_user_id_course_id_week_sort_order_idx"
ON "student_custom_modules"("user_id", "course_id", "week", "sort_order");
ALTER TABLE "student_custom_modules"
ADD CONSTRAINT "student_custom_modules_user_id_fkey"
FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "student_custom_modules"
ADD CONSTRAINT "student_custom_modules_course_id_fkey"
FOREIGN KEY ("course_id") REFERENCES "courses"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,3 @@
UPDATE "student_custom_modules"
SET "folder_name" = '[lms-nav2-custom]' || "package_name" || '_v1.0.0_ws'
WHERE "folder_name" <> '[lms-nav2-custom]' || "package_name" || '_v1.0.0_ws';
+24
View File
@@ -32,6 +32,7 @@ model User {
platformControlQueueEntries PlatformControlQueueEntry[]
studioRepositories StudioRepository[]
savedMaps StudentSavedMap[]
customModules StudentCustomModule[]
submissionScores SubmissionScore[]
submissionTotalScores SubmissionTotalScore[]
@@ -160,6 +161,7 @@ model Course {
maps CourseMap[]
weekMaps CourseWeekMap[]
savedMaps StudentSavedMap[]
customModules StudentCustomModule[]
submissionScores SubmissionScore[]
submissionTotalScores SubmissionTotalScore[]
@@ -277,6 +279,28 @@ model StudentSavedMap {
@@map("student_saved_maps")
}
model StudentCustomModule {
id String @id @default(uuid()) @db.Uuid
userId String @map("user_id") @db.Uuid
courseId String @map("course_id") @db.Uuid
week Int
sortOrder Int @map("sort_order")
category String
name String
folderName String @map("folder_name")
dockerImage String? @map("docker_image")
packageName String @map("package_name")
launchFile String @map("launch_file")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
course Course @relation(fields: [courseId], references: [id], onDelete: Cascade)
@@unique([userId, courseId, week, folderName])
@@index([userId, courseId, week, sortOrder])
@@map("student_custom_modules")
}
model InstructorCurriculumSetting {
id String @id @default(uuid()) @db.Uuid
organizationId String? @map("organization_id") @db.Uuid