mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-28 07:17:04 +02:00
chore(core): Remove md5 usage for user id generation in postgres (#21687)
This commit is contained in:
parent
13b7fa5c68
commit
8aed72ffb1
|
|
@ -0,0 +1,18 @@
|
|||
import type { IrreversibleMigration, MigrationContext } from '../migration-types';
|
||||
|
||||
/**
|
||||
* PostgreSQL-specific migration to change the default value for the `id` column in `user` table.
|
||||
* The previous default implementation was based on MD5 hashing to produce a random UUID, but
|
||||
* MD5 is not supported in FIPS compliant postgres environments. We are switching to `gen_random_uuid()`
|
||||
* which is supported in versions of PostgreSQL since 13.
|
||||
*/
|
||||
export class ChangeDefaultForIdInUserTable1762771264000 implements IrreversibleMigration {
|
||||
async up({ queryRunner, escape }: MigrationContext) {
|
||||
const tableName = escape.tableName('user');
|
||||
const idColumnName = escape.columnName('id');
|
||||
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE ${tableName} ALTER COLUMN ${idColumnName} SET DEFAULT gen_random_uuid()`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -111,6 +111,7 @@ import { DropUnusedChatHubColumns1760965142113 } from '../common/1760965142113-D
|
|||
import { AddWorkflowDescriptionColumn1762177736257 } from '../common/1762177736257-AddWorkflowDescriptionColumn';
|
||||
import { BackfillMissingWorkflowHistoryRecords1762763704614 } from '../common/1762763704614-BackfillMissingWorkflowHistoryRecords';
|
||||
import type { Migration } from '../migration-types';
|
||||
import { ChangeDefaultForIdInUserTable1762771264000 } from './1762771264000-ChangeDefaultForIdInUserTable';
|
||||
|
||||
export const postgresMigrations: Migration[] = [
|
||||
InitialMigration1587669153312,
|
||||
|
|
@ -225,4 +226,5 @@ export const postgresMigrations: Migration[] = [
|
|||
AddWorkflowDescriptionColumn1762177736257,
|
||||
CreateOAuthEntities1760116750277,
|
||||
BackfillMissingWorkflowHistoryRecords1762763704614,
|
||||
ChangeDefaultForIdInUserTable1762771264000,
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user