Files
myeasycms-v2/supabase/tests/database/00000-makerkit-helpers.sql
giancarlo bce3479368 Cleanup
2024-03-24 02:23:22 +08:00

38 lines
825 B
PL/PgSQL

create schema if not exists makerkit;
-- anon, authenticated, and service_role should have access to tests schema
grant USAGE on schema makerkit to anon, authenticated, service_role;
-- Don't allow public to execute any functions in the tests schema
alter default PRIVILEGES in schema makerkit revoke execute on FUNCTIONS from public;
-- Grant execute to anon, authenticated, and service_role for testing purposes
alter default PRIVILEGES in schema makerkit grant execute on FUNCTIONS to anon,
authenticated, service_role;
create or replace function makerkit.get_account_by_slug(
account_slug text
)
returns setof accounts
as $$
begin
return query
select
*
from
accounts
where
slug = account_slug;
end;
$$ language PLPGSQL;
select
*
from
finish();
rollback;