Skip to content

Commit

Permalink
Remove unnecessary characters from the user data
Browse files Browse the repository at this point in the history
  • Loading branch information
Ossi Tammi committed Sep 17, 2024
1 parent a02d9d2 commit 96c5f6e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/migrations/1726555482728_user-org-migrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable no-useless-escape */
import { ColumnDefinitions, MigrationBuilder } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.sql(`
UPDATE application.user appuser
SET organizations = ARRAY(
SELECT REGEXP_REPLACE(unnest(appuser.organizations), '\[\"|\"\]', '', 'g')
)
WHERE appuser.id is not null;
`)
}

0 comments on commit 96c5f6e

Please sign in to comment.