Skip to content

Commit 0c7dba0

Browse files
committed
fix(migrations): keep the lowest ID duplicate group instead of highest
1 parent 4505792 commit 0c7dba0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

backend/database/migrations/1739621172974_groups_add_unique_index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class extends BaseSchema {
77
await this.db.rawQuery(`
88
BEGIN;
99
WITH "duplicates" AS (
10-
SELECT MAX("id") AS "id", "name", "start_time", "end_time", "group", "week", "day", "type", "course_id"
10+
SELECT MIN("id") AS "id", "name", "start_time", "end_time", "group", "week", "day", "type", "course_id"
1111
FROM "groups"
1212
GROUP BY "name", "start_time", "end_time", "group", "week", "day", "type", "course_id"
1313
HAVING COUNT(*) > 1

0 commit comments

Comments
 (0)