forked from aerx-dev/aerx-mvp-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlQuery.example
61 lines (49 loc) · 1.6 KB
/
sqlQuery.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- Turn on automatic inflection of type names
comment on schema public is '@graphql({"inflect_names": true})';
create table account(
id serial primary key,
email varchar(255) not null,
created_at timestamp not null,
updated_at timestamp not null
);
-- enable a `totalCount` field on the `account` query type
comment on table account is e'@graphql({"totalCount": {"enabled": true}})';
create table post(
id serial primary key,
owner_id integer not null references account(id),
name varchar(255) not null,
description varchar(255),
created_at timestamp not null,
updated_at timestamp not null
);
create type post_nft_status as enum ('PENDING', 'POSTED');
create table post_nft(
id uuid not null default uuid_generate_v4() primary key,
post_id integer not null references post(id),
title varchar(255) not null,
media varchar(255),
media_hash varchar(255),
media_type varchar(255),
totalCharged float,
extra varchar(10000),
body varchar(10000),
status post_nft_status not null,
created_at timestamp not null,
updated_at timestamp not null
);
alter table Post enable row level security;
create policy "Public contents are viewable by everyone."
on Post for select
using ( true );
-- Set up Realtime!
begin;
drop publication if exists supabase_realtime;
create publication supabase_realtime;
commit;
alter publication supabase_realtime add table Post;
-- Set up Storage!
insert into storage.buckets (id, name)
values ('Post', 'Post');
create policy "Post publicly accessible."
on storage.objects for select
using ( bucket_id = 'Post' );