Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not use safe for base queries #23

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/ports/squids/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,21 @@ export const getPromoteQuery = (serviceName: string, schemaName: string, project
}

export const getSchemaByServiceNameQuery = (serviceName: string): SQLStatement => {
const safeServiceName = escapeLiteral(serviceName)
return SQL`
SELECT schema
FROM public.indexers
WHERE service = ${safeServiceName}
WHERE service = ${serviceName}
ORDER BY created_at DESC
LIMIT 1;
`
}

export const getActiveSchemaQuery = (serviceName: string): SQLStatement => {
const projectName = getProjectNameFromService(serviceName)
const safeProjectName = escapeLiteral(projectName)

return SQL`
SELECT schema
FROM public.squids
WHERE name = ${safeProjectName};
WHERE name = ${projectName};
`
}