soedirgo
09/07/2021, 7:17 AMstibbs
09/07/2021, 7:18 AMstibbs
09/07/2021, 7:19 AMDROP procedure name;
worked. It no longer shows in my Functions list of the supabase ui 👍stibbs
09/07/2021, 7:21 AMsql
{"hint":null,"message":"null value in column \"invoice_id\" of relation \"jobs\" violates not-null constraint","code":"23502","details":"Failing row contains (...)."}
Anyone willing to help me debug? I'll post the code in a thread cause it's relatively bigquicksnap
09/09/2021, 12:46 AMnew row violates row-level security policy for table
quicksnap
09/09/2021, 12:46 AMWITH CHECK (true)
quicksnap
09/09/2021, 12:47 AMquicksnap
09/09/2021, 12:49 AMburggraf
09/09/2021, 1:11 AMDyingAlbatross
09/09/2021, 2:38 AMsynchron
09/10/2021, 9:16 AMcreate table sessionUser (
sessionID text not null,
useruid text,
username text not null
);
Now i want the users to be able to add themself to a session.
But this should only be allowed if the useruid that the users sends is the same as the logged in user OR if the useruid is empty
this looks like this:
create policy "Users can insert if loggedIn or anonymous"
on sessionUser for insert
with check ( (auth.uid() = useruid OR useruid == null) );
Now there is one Problem.
I want to prevent a second user to join the session with a name that is allready used.
But i cant make it unique, because in other sessions the name is allowed.
How do i make a query in this check for usernames in relation to sessionIDs and disallow used usernames?
Thankssilentworks
09/10/2021, 9:18 AMsynchron
09/10/2021, 9:19 AMcreate table sessionUser (
sessionID text not null,
useruid text,
username text not null,
primary key (sessionID, username)
);
synchron
09/10/2021, 9:19 AMsynchron
09/10/2021, 9:31 AMSduu_
09/10/2021, 1:15 PMsql
select distinct on (s.name)
max(s.group_id) as group_id,
s.name
from aggregate_settings as s
where s.group_id = 0 or s.group_id in (
select
ugr.group_id
from
user_group_relations as ugr
where ugr.user_id = '1c851fa2-4838-4e28-a92b-8b33bc9d5aad'
)
group by s.name;
Sduu_
09/10/2021, 1:15 PMScott P
09/10/2021, 2:33 PMzakaria.chahboun
09/11/2021, 11:37 AM(public/products/feca4889.png)
I stored this full path in a table like this:
``
+----+---------+------------------------------+
| id | product | image |
+----+---------+------------------------------+
| 1 | orange | public/products/feca4889.png |
+----+---------+------------------------------+
``
Now! How i can retrieve the bucket_id
and the name
of my product image from the full path?
like that:
SQL
delete from storage.objects where bucket_id = 'public' and name = 'products/feca4889.png'
Thanks!zakaria.chahboun
09/11/2021, 12:00 PMbucket_id
from the full path:
SQL
select split_part('public/products/feca4889.png', '/', 1);
To retrieve name
from the full path:
SQL
select array_to_string((string_to_array('public/products/feca4889.png', '/'))[2:], '/');
zakaria.chahboun
09/11/2021, 12:15 PMRichCorbs
09/11/2021, 7:29 PMNico Maybach
09/12/2021, 11:01 AMBrock
09/13/2021, 3:26 PMALTER TABLE public.profiles
ADD COLUMN email varchar references auth.users not null;
returns this error
foreign key constraint "profiles_email_fkey" cannot be implemented
Brock
09/13/2021, 4:16 PMpublic.profiles
field id
that references auth.users
field id
?Brock
09/13/2021, 4:30 PMALTER TABLE public.profiles
ADD COLUMN email varchar,
add constraint profiles_email_fkey
foreign key (email)
references auth.users (email)
SETY
09/13/2021, 9:54 PMSETY
09/13/2021, 9:55 PMSETY
09/13/2021, 9:55 PMBrock
09/13/2021, 10:25 PM