dbco0per
09/21/2022, 2:47 PMlewisd
09/21/2022, 4:03 PMread_user_messages
and create a link to all the messages they've read?
Please find my current db design attachedkapsonfire
09/21/2022, 4:56 PMLukas V
09/21/2022, 5:24 PMFailed to run sql query: cannot truncate a table referenced in a foreign key constraint
Another question is - how do I reset the row count back to 1?mintavenger
09/21/2022, 5:45 PMwholelotta
09/21/2022, 6:28 PMSand Kingston
09/21/2022, 8:05 PMORDER BY array_position(task_order, task_id)
, which works perfectly. How can I order like that when making a query in supabase? The query looks like this:
await supabase.from('board')
.select(`
id,
title,
description,
taskOrder: task_order,
tasks(
title,
description
)
`)
.eq('id', id);
AtomsInTheVoid
09/21/2022, 8:49 PMhttps://uvozsbejenxqdtse.supabase.co/storage/v1/object/sign/test/637977266224775676.jpg?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJ0ZXN0LzYzNzk3NzI2NjIyNDc3NTY3Ni5qXQiOjE2NjM3OTI4ODAsImV4cCI6MTk3OTE1Mjg4MH0.u0gxH1s2wYNM_DZP_HGLx6TEOG5-1I1mY70PtUFHilk
(altered slightly so it won't actually work for you).
This actually works, I can GET from here and receive the image. But I need to lock it down so only auth users can grab this file. The weird thing, is the Token here isn't a JWT token, nor is it my apikey.. it's something else? Something that doesn't expire either because it can be two days later and the link will still work.
a) what is this "token"?
b) how do I lock it down so only people with the jwt token can GET/POST into the bucket?
Maybe this isn't possible, which will be a shame because that'll be a dealbreaker and it's literally the last thing I need to get working...DanMossa
09/21/2022, 11:39 PMmessages
, that my app subscribes to based on inserts.
This has been working, it stops working once I have added a trigger to that table. Any ideas?
When debugging I noticed that if I change the Enabled mode
on my trigger to Origin
, the trigger activates but realtime stops working. If I set it to Replica
, realtime works but the trigger doesn't activate.
Setting it to Always
makes the trigger work, but not realtime.
I also noticed that nothing is actually being inserted into the messages
table when my trigger is set to Origin
or Always
. Which is why realtime isn't working, because there's nothing being inserted.
Anyone know why inserts stopping working after Triggers are enabled?organicX
09/22/2022, 1:50 AMven
09/22/2022, 2:24 AMPrashant Singh
09/22/2022, 5:09 AMmaglev
09/22/2022, 6:28 AM49Ryann
09/22/2022, 6:41 AMbinajmen
09/22/2022, 7:33 AMCANDY
09/22/2022, 10:46 AMObject { message: "FetchError: NetworkError when attempting to fetch resource.", details: "", hint: "", code: "" }
YelloJello
09/22/2022, 11:31 AMsupabase_admin
should have to view logs?
js
{
"code": 403,
"message": "Failed to get project's logs",
"requestId": "45c2ebe6-5ee3-4589-91c0-99091cb145e9"
}
tyakymiuk
09/22/2022, 1:05 PMThe Aleks
09/22/2022, 1:13 PMhandleAuth
function which creates the login/logout endpoint for cookie authentication. Why is that?49Ryann
09/22/2022, 1:58 PMdrewbie
09/22/2022, 2:54 PMcreate trigger add_shop_user_from_shop
after insert on public.shops
for each row execute procedure public.add_user_shop_from_shop();
create function public.add_user_shop_from_shop()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
insert into public.user_shops(user_id, shop_id, role)
values (auth.uid(), new.id, 'ADMIN');
return new;
end;
$$;
Which all works fine and well.
I've decided that I want to create a shop for a user when a user record is created. However, I can not able to get that trigger/function to work as the prior one is already migrated into the database. I am trying
create trigger create_shop_from_user
after insert on public.users
for each row execute procedure public.create_shop_from_user();
create function public.create_shop_from_user()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
insert into public.shops DEFAULT VALUES;
return new;
end;
$$;
But I am getting an error saving the user and its due to the association of the user_shop to the user. How do I create a shop from an inserted user in the new function while allowing the existing function that creates the user_shop association row to still run? Any help is appreciated!Migu
09/22/2022, 3:13 PMsupabase gen types typescript --db-url postgresql://etc etc
; the debug error message says "connect ECONNREFUSED 52.59.3.55:5432 and from the looks of it it's an Amazon IP address.
Could I be timed out for security reasons, could Amazon encounter issues (I doubt somehow) or am I doing something wrong?
It does work most of the time, it's just that sometimes it decides not to and block on that… Anyone else had this?Miguel Espinoza
09/22/2022, 3:52 PMglobal.headers
With this configuration, unfortunately, I'm unable to get session or user. Is this expected?
More details in the issue I reported: https://github.com/supabase/gotrue-js/issues/450
P.S. Too many auth issues with supabase... It's a bit concerning. Hopefully this is an oversight on my endenyo
09/22/2022, 4:12 PMsupabase.auth.session()
and would get the current session immediately which is good, since it allows to update the UI directly.
How can this be achieved in v2? The only thing I see is supabase.auth.getSession()
and it's async.davitykale
09/22/2022, 6:41 PMtyakymiuk
09/22/2022, 9:06 PMcreate or replace function calc_plv8()
returns setof user_profiles
as
$$
const result = plv8.execute('SELECT * FROM user_profiles');
plv8.elog(NOTICE, 'this', 'is', 'inline', 'code');
plv8.elog(INFO, 'this', 'is', 'inline', 'code');
plv8.elog(DEBUG5, 'this', 'is', 'inline', 'code');
return result;
$$
language plv8
SECURITY DEFINER;
select * from calc_plv8()
P.S. function itself is working and returning what's needed but with no logsAtomsInTheVoid
09/22/2022, 10:39 PMUser123 \ CoolTechInc \ file a
User456 \ CoolTechInc \ file b
User456 \ HotTechInc \ file c
User789 \ OtherCompany \ file d
User123 should be able to access file a & b, and User 456 file a & b & c, and User789 only file d
My pathing scheme above might not be the smartest way so I'm wondering how it's done out there in the real world? I've used other webapps that allow this, such as Miro where you can go in alone, or invite others from your org to collaborate with youPatryk Makowski
09/22/2022, 11:35 PMlewisd
09/23/2022, 8:27 AMlet query = supabase.rpc("search_listings", {
search_query: searchQuery,
});
if (conditions.length > 0) {
const string = conditions.reduce((string, currentCondition, index) => {
return (string += `lineItems->>condition.eq.${currentCondition}${
index < conditions.length - 1 ? "," : ""
}`);
}, "");
query = query.or(string);
}
const { data } = await query.limit(10);
It's currently not working when a condition is selected. If I console.log
the .or()
string, I get:
lineItems->>condition.eq.new
bhark
09/23/2022, 10:45 AMteams
and members
. These two are joined by a many-to-many table, which holds of course its own ID
, team_id
and member_id
, as a composite primary key.
Team members can have varying privileges in their teams. They can have no privileges (received an invite), read-only (invited as a user) and read-write-delete (team manager).
I can solve this by having three different join tables: project_invites
, project_members
and project_admins
. This seems lame.
I'd like to be able to define their role directly in the join table, and be able to use this when writing RLS policies. Is this possible? - and if so, how do I go about it?
Thanks (: