0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/schemas/alterations/next-1719221205-fix-functions.ts

25 lines
788 B
TypeScript

/**
* In Logto Cloud, we have multiple schemas and the default search behavior will be problematic.
* This alteration script will fix it by setting the search path to public for the functions.
*/
import { sql } from '@silverhand/slonik';
import type { AlterationScript } from '../lib/types/alteration.js';
const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
alter function check_application_type set search_path = public;
alter function check_organization_role_type set search_path = public;
`);
},
down: async (pool) => {
await pool.query(sql`
alter function check_application_type reset search_path;
alter function check_organization_role_type reset search_path;
`);
},
};
export default alteration;