-
Notifications
You must be signed in to change notification settings - Fork 0
Add Event Streams Table #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
supabase/migrations/20251118223330_create_event_streams.sql
This file contains hidden or 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,86 @@ | ||
| create type "public"."stream_platform" as enum ('Twitch', 'Youtube'); | ||
|
|
||
| create table "public"."event_streams" ( | ||
| "id" bigint generated by default as identity not null, | ||
| "event_id" uuid not null, | ||
| "title" varchar(255), | ||
| "platform" stream_platform not null, | ||
| "channel" varchar(255) not null, | ||
| "url" varchar(512), | ||
| "internal_id" varchar(255), | ||
| "start_time" timestamp with time zone | ||
| ); | ||
|
|
||
| alter table "public"."event_streams" enable row level security; | ||
|
|
||
| CREATE UNIQUE INDEX event_streams_pkey ON public.event_streams USING btree (id); | ||
|
|
||
| alter table "public"."event_streams" add constraint "event_streams_pkey" PRIMARY KEY using index "event_streams_pkey"; | ||
|
|
||
| alter table "public"."event_streams" add constraint "public_event_streams_event_id_fkey" FOREIGN KEY (event_id) REFERENCES events(id) not valid; | ||
|
|
||
| alter table "public"."event_streams" validate constraint "public_event_streams_event_id_fkey"; | ||
|
|
||
| create policy "SELECT event_streams global" | ||
| on "public"."event_streams" | ||
| as permissive | ||
| for select | ||
| to authenticated | ||
| using ( | ||
| ((auth.jwt() -> 'app_metadata'::text) -> 'globalPermissions'::text) @> '"Events_View"'::jsonb | ||
| ); | ||
|
|
||
| create policy "SELECT event_streams event_staff" | ||
| on "public"."event_streams" | ||
| as permissive | ||
| for select | ||
| to authenticated | ||
| using (event_id IN ( | ||
| SELECT event_staffs.event_id | ||
| FROM event_staffs | ||
| WHERE ( | ||
| event_staffs.user_id = (SELECT auth.uid() AS uid) AND | ||
| ('Event_View'::text = ANY (event_staffs.permissions)) | ||
| ) | ||
| )); | ||
|
|
||
| create policy "SELECT event_streams av_token" | ||
| on "public"."event_streams" | ||
| as permissive | ||
| for select | ||
| to public | ||
| using ( | ||
| event_id = (auth.jwt() ->> 'eventId'::text)::uuid | ||
| ); | ||
|
|
||
| grant select on table "public"."event_streams" to "anon"; | ||
|
|
||
| grant trigger on table "public"."event_streams" to "anon"; | ||
|
|
||
|
Techno11 marked this conversation as resolved.
|
||
| grant delete on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant insert on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant references on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant select on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant trigger on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant truncate on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant update on table "public"."event_streams" to "authenticated"; | ||
|
|
||
| grant delete on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant insert on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant references on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant select on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant trigger on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant truncate on table "public"."event_streams" to "service_role"; | ||
|
|
||
| grant update on table "public"."event_streams" to "service_role"; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.