From ce36b01265cdde82f21ad9c58e8b5b47bbe8abe6 Mon Sep 17 00:00:00 2001 From: Theresa Kamerman Date: Mon, 11 Mar 2024 14:50:08 -0700 Subject: [PATCH] Add Schema Qualifier to SQL statements - Write to Permissions schema instead of Metadata --- src/packages/auth/functions.ts | 8 ++++---- src/packages/files/files.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/packages/auth/functions.ts b/src/packages/auth/functions.ts index ec38e6e..0f70e2d 100644 --- a/src/packages/auth/functions.ts +++ b/src/packages/auth/functions.ts @@ -44,7 +44,7 @@ export async function getUserRoles( const { rows, rowCount } = await db.query( ` select hasura_default_role, hasura_allowed_roles - from metadata.users_and_roles + from permissions.users_and_roles where username = $1; `, [username], @@ -66,7 +66,7 @@ export async function deleteUserAllowedRoles(username: string) { await db.query( ` - delete from metadata.users_allowed_roles + delete from permissions.users_allowed_roles where username = $1; `, [username], @@ -78,7 +78,7 @@ export async function upsertUserRoles(username: string, default_role: string, al await db.query( ` - insert into metadata.users (username, default_role) + insert into permissions.users (username, default_role) values ($1, $2) on conflict (username) do update set default_role = excluded.default_role; @@ -89,7 +89,7 @@ export async function upsertUserRoles(username: string, default_role: string, al for (const allowed_role of allowed_roles) { await db.query( ` - insert into metadata.users_allowed_roles (username, allowed_role) + insert into permissions.users_allowed_roles (username, allowed_role) values ($1, $2) `, [username, allowed_role], diff --git a/src/packages/files/files.ts b/src/packages/files/files.ts index 85faa13..d418b85 100644 --- a/src/packages/files/files.ts +++ b/src/packages/files/files.ts @@ -69,7 +69,7 @@ export default (app: Express) => { const deleted_date = new Date(); const { rowCount } = await db.query( ` - update uploaded_file + update merlin.uploaded_file set deleted_date = $1 where id = $2; `, @@ -123,7 +123,7 @@ export default (app: Express) => { // twice so the query casts it appropriately to each type. const { rowCount, rows } = await db.query( ` - insert into uploaded_file (name, path) + insert into merlin.uploaded_file (name, path) values ($1, $2) returning id; `,