Skip to content

Commit d1fe075

Browse files
Migration: Clean unused assets and ensure there are no nodes without files - refs #7121
1 parent 94f02fc commit d1fe075

File tree

2 files changed

+550
-139
lines changed

2 files changed

+550
-139
lines changed

src/CoreBundle/Migrations/Schema/V200/Version20251130011600.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function declareNewResourceTypes(): void
147147
"INSERT INTO resource_type (title, tool_id, created_at, updated_at)
148148
SELECT 'attempt_file', t.id, NOW(), NOW()
149149
FROM tool t
150-
WHERE t.name = 'quiz'
150+
WHERE t.title = 'quiz'
151151
AND NOT EXISTS (
152152
SELECT 1 FROM resource_type WHERE title = 'attempt_file'
153153
)"
@@ -158,7 +158,7 @@ private function declareNewResourceTypes(): void
158158
"INSERT INTO resource_type (title, tool_id, created_at, updated_at)
159159
SELECT 'attempt_feedback', t.id, NOW(), NOW()
160160
FROM tool t
161-
WHERE t.name = 'quiz'
161+
WHERE t.title = 'quiz'
162162
AND NOT EXISTS (
163163
SELECT 1 FROM resource_type WHERE title = 'attempt_feedback'
164164
)"
@@ -167,7 +167,7 @@ private function declareNewResourceTypes(): void
167167
// Safety net: if rows already exist but have tool_id = NULL, link them to quiz as well.
168168
$this->addSql(
169169
"UPDATE resource_type rt
170-
JOIN tool t ON t.name = 'quiz'
170+
JOIN tool t ON t.title = 'quiz'
171171
SET rt.tool_id = t.id
172172
WHERE rt.title IN ('attempt_file', 'attempt_feedback')
173173
AND (rt.tool_id IS NULL OR rt.tool_id = 0)"

0 commit comments

Comments
 (0)