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

26 lines
788 B
TypeScript
Raw Normal View History

/**
* 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;