-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to TLE-based installation (#2)
- Loading branch information
1 parent
cbde21c
commit 3b7fa01
Showing
7 changed files
with
380 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Prettier-SQL.SQLFlavourOverride": "postgresql", | ||
"sqltools.connections": [ | ||
{ | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 54322, | ||
"driver": "PostgreSQL", | ||
"name": "Supabase Local", | ||
"database": "postgres", | ||
"username": "postgres", | ||
"password": "postgres" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
drop trigger if exists "on_change_update_user_metadata" on "public"."group_users"; | ||
|
||
drop trigger if exists "on_insert_set_group_owner" on "public"."groups"; | ||
|
||
drop trigger if exists "on_delete_user" on "public"."user_roles"; | ||
|
||
alter table "public"."group_users" drop constraint "group_users_group_id_fkey"; | ||
|
||
alter table "public"."group_users" drop constraint "group_users_user_id_fkey"; | ||
|
||
drop function if exists "public"."add_group_user_by_email"(user_email text, gid uuid, group_role text); | ||
|
||
drop function if exists "public"."delete_group_users"(); | ||
|
||
drop function if exists "public"."has_group_role"(group_id uuid, group_role text); | ||
|
||
drop function if exists "public"."is_group_member"(group_id uuid); | ||
|
||
drop function if exists "public"."jwt_has_group_role"(group_id uuid, group_role text); | ||
|
||
drop function if exists "public"."jwt_is_expired"(); | ||
|
||
drop function if exists "public"."jwt_is_group_member"(group_id uuid); | ||
|
||
drop function if exists "public"."set_group_owner"(); | ||
|
||
drop function if exists "public"."update_user_roles"(); | ||
|
||
drop view if exists "public"."user_roles"; | ||
|
||
alter table "public"."group_users" drop constraint "group_users_pkey"; | ||
|
||
alter table "public"."groups" drop constraint "group_pkey"; | ||
|
||
drop index if exists "public"."group_pkey"; | ||
|
||
drop index if exists "public"."group_users_group_id_idx"; | ||
|
||
drop index if exists "public"."group_users_pkey"; | ||
|
||
drop table "public"."group_users"; | ||
|
||
drop table "public"."groups"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
create extension if not exists http | ||
with | ||
schema extensions; | ||
|
||
create extension if not exists pg_tle; | ||
|
||
select | ||
pgtle.uninstall_extension_if_exists ('supabase-dbdev'); | ||
|
||
drop extension if exists "supabase-dbdev"; | ||
|
||
select | ||
pgtle.install_extension ( | ||
'supabase-dbdev', | ||
resp.contents ->> 'version', | ||
'PostgreSQL package manager', | ||
resp.contents ->> 'sql' | ||
) | ||
from | ||
http ( | ||
( | ||
'GET', | ||
'https://api.database.dev/rest/v1/' || 'package_versions?select=sql,version' || '&package_name=eq.supabase-dbdev' || '&order=version.desc' || '&limit=1', | ||
array[ | ||
( | ||
'apiKey', | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhtdXB0cHBsZnZpaWZyYndtbXR2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODAxMDczNzIsImV4cCI6MTk5NTY4MzM3Mn0.z2CN0mvO2No8wSi46Gw59DFGCTJrzM0AQKsu_5k134s' | ||
)::http_header | ||
], | ||
null, | ||
null | ||
) | ||
) x, | ||
lateral ( | ||
select | ||
((row_to_json(x) -> 'content') #>> '{}')::json -> 0 | ||
) resp (contents); | ||
|
||
create extension "supabase-dbdev"; | ||
|
||
select | ||
dbdev.install ('supabase-dbdev'); | ||
|
||
drop extension if exists "supabase-dbdev"; | ||
|
||
create extension "supabase-dbdev"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
select | ||
dbdev.install ('pointsource-supabase_rbac'); | ||
|
||
create extension if not exists "pointsource-supabase_rbac" | ||
with | ||
schema "public" version '0.0.1'; |
Oops, something went wrong.