-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 7.0.0
- Loading branch information
Showing
11 changed files
with
216 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
src/modules/database/migrations/postgres/1695686400000-check-user-case-conflicts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
export class CheckUserCaseConflicts1695686400000 implements MigrationInterface { | ||
name?: string; | ||
transaction?: boolean; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
// Check for conflicting users with different casing for username or email | ||
const duplicateUsers = await queryRunner.query(` | ||
SELECT u.username, u.email | ||
FROM gamevault_user u | ||
WHERE (LOWER(u.username), LOWER(u.email)) IN ( | ||
SELECT LOWER(username), LOWER(email) | ||
FROM gamevault_user | ||
GROUP BY LOWER(username), LOWER(email) | ||
HAVING COUNT(*) > 1 | ||
); | ||
`); | ||
|
||
if (duplicateUsers.length > 0) { | ||
throw new Error( | ||
`User conflicts detected with different casing for username or email. Please roll back to GameVault Backend Version 6.0.0 and resolve the conflicts before updating to v7.0.0.\nConflicting Users: ${JSON.stringify( | ||
duplicateUsers, | ||
null, | ||
2, | ||
)}`, | ||
); | ||
} | ||
} | ||
|
||
public async down(): Promise<void> { | ||
// This is a migration to check for conflicts; no need for a down operation | ||
} | ||
} |
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
src/modules/database/migrations/sqlite/1695686400000-check-user-case-conflicts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
export class CheckUserCaseConflicts1695686400000 implements MigrationInterface { | ||
name?: string; | ||
transaction?: boolean; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
// Check for conflicting users with different casing for username or email | ||
const duplicateUsers = await queryRunner.query(` | ||
SELECT u.username, u.email | ||
FROM gamevault_user u | ||
WHERE (LOWER(u.username), LOWER(u.email)) IN ( | ||
SELECT LOWER(username), LOWER(email) | ||
FROM gamevault_user | ||
GROUP BY LOWER(username), LOWER(email) | ||
HAVING COUNT(*) > 1 | ||
); | ||
`); | ||
|
||
if (duplicateUsers.length > 0) { | ||
throw new Error( | ||
`User conflicts detected with different casing for username or email. Please roll back to GameVault Backend version 6.0.0 and resolve the conflicts before updating to v7.0.0.\nConflicting Users: ${JSON.stringify( | ||
duplicateUsers, | ||
null, | ||
2, | ||
)}`, | ||
); | ||
} | ||
} | ||
|
||
public async down(): Promise<void> { | ||
// This is a migration to check for conflicts; no need for a down operation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.