AVEN
02/09/2023, 2:56 AMEthanxyz
02/09/2023, 3:18 AMjs
let { data: items, error } = await supabase
.from("items")
.select("*, created_by(*), type(*), game(*))")
.eq("created_by", user.id);
Now, user.id
is a FK within the items
table and points to a user in the profiles
table.
Within my front end, I want my URL too look like example.com/[username]
, but, as you can see, I am not using a [username]
in this query, but rather a user.id
( which can look quite long and ugly ).
That said, I want to pass in username
from the profiles
table, but I am not sure how to obtain it.
I want to do something like .eq("created_by", profiles: id = created_by)
.
How should I go about this ?JustinT
02/09/2023, 3:23 AMsql
select country, sum(sales) from table
group by country
But I want to add a filter to filter by age for example.
But I also want multiple filters.
Is there anyway to do this that doesn’t require creating some SQL function?sinrabo
02/09/2023, 3:29 AMrbl
02/09/2023, 4:06 AM➜ git:(main) ✗ brew info supabase
==> supabase/tap/supabase: stable 1.37.1
After upgrading, my realtime subscriptions in my local supabase instance stopped working:
I'm getting the message from the realtime server:
"Subscribing to PostgreSQL failed: {:error, {:subscription_insert_failed, %{\"event\" => \"*\", \"schema\" => \"public\"}}}"
And the docker logs for the realtime instance are being spammed by:
04:04:14.177 project=realtime-dev external_id=realtime-dev [error] Subscribing to PostgreSQL failed: {:error, {:subscription_insert_failed, %{"event" => "*", "schema" => "public"}}}
jinsley8
02/09/2023, 5:04 AMbash
Failed to run sql query: update or delete on table "users" violates foreign key constraint "users_id_fkey" on table "users"
Failed to run sql query: update or delete on table "users" violates foreign key constraint "profiles_id_fkey" on table "profiles"
Here are my tables. I thought I had cascade on delete set already. When a user is created in next_auth.users it automatically generates a row in public.users and a row in public.profiles.
Anyone see anything wrong with what I have setup here? The id across all three tables is the same for a user.
sql
--
-- Create next_auth.users table
--
CREATE TABLE IF NOT EXISTS next_auth.users (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
address text NOT NULL UNIQUE,
provider_id text NOT NULL UNIQUE,
aud text,
role text,
created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
CONSTRAINT users_pkey PRIMARY KEY (id),
);
--
-- Create public tables
--
-- USERS
CREATE TABLE IF NOT EXISTS public.users (
id uuid references next_auth.users (id) on delete cascade PRIMARY KEY,
address text references next_auth.users(address) PRIMARY KEY,
email_address text UNIQUE,
email_verified boolean,
verify_token uuid,
verify_sent_at timestamp with time zone,
created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
);
-- PROFILES
CREATE TABLE IF NOT EXISTS public.profiles (
id uuid references public.users(id) on delete cascade PRIMARY KEY,
address text references public.users(address) PRIMARY KEY,
name text UNIQUE,
logo text,
created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
);
Vik
02/09/2023, 5:29 AMUberzeek
02/09/2023, 6:11 AM최지연
02/09/2023, 6:39 AMDeChill
02/09/2023, 7:59 AMconfig.toml
?
I already have the Storage RLS Policies in my Migrations, but I still have to manually to to the Portal and create the Storage Container by hand.
I didn't find anything in the docs so far 🫤
Thanks in advance!Monimolimnion
02/09/2023, 8:07 AMurql
client to make a GraphQL request to Supabase. I've included what I think are the right headers, in the right way, but it's still throwing a CORS error in the browser:
const client = createClient({
url: 'https://my-endpoint.supabase.co',
fetchOptions: () => {
return {
headers: {
apikey:
'my-api-key',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type'
}
};
}
});
Any ideas what I'm doing wrong?stunna
02/09/2023, 8:17 AMTheBuilderJR
02/09/2023, 8:48 AMMichal
02/09/2023, 9:16 AMdavetayls
02/09/2023, 9:19 AMdav
02/09/2023, 9:31 AMshow work_mem
>>> "5MB"
SET work_mem TO '16MB';
show work_mem
>> "5MB"
Despite my command, work_mem
doesn't update. Am I entering the wrong command?49Ryann
02/09/2023, 9:55 AMFirebat
02/09/2023, 10:13 AMrem
02/09/2023, 1:05 PMworkspaces
table and workspace_users
join table.
In SQL I want to do:
SELECT
w.*
FROM
workspaces w,
workspace_users wu
WHERE
wu.workspace_id=w.id AND
wu.user_id='user_xyz_id';
i.e. constrain on the join table.
Except I can't work out how to do this with the JS library without including fields from the workspace_users
table, which I don't want (mostly to satisfy TypeScript).
My code looks like this (but errors):
let { error, data: workspace } = await client
.from("workspaces")
.select("id, slug, name, created_at, type")
.eq("workspace_user.user_id", user.id)
.limit(1)
.maybeSingle();
I get this error:
{
error: {
code: 'PGRST108',
details: null,
hint: 'Verify that \'workspace_user\' is included in the \'select\' query parameter.',
message: 'Cannot apply filter because \'workspace_user\' is not an embedded resource in this request'
}
How do I query without selecting?avalanche
02/09/2023, 2:07 PMdart
final supabase = SupabaseClient(supabaseUrl, supabaseServiceRoleKey);
await supabase.auth.admin
.createUser(AdminUserAttributes(
email: 'user@example.com',
password: 'test123'
));
somoni
02/09/2023, 2:57 PMJu Li
02/09/2023, 3:31 PMdev Joakim Pedersen
02/09/2023, 3:33 PMSantiago
02/09/2023, 3:37 PMJannik
02/09/2023, 3:50 PMColors
02/09/2023, 4:51 PMdocker compose up
it still gives me this error:
Error response from daemon: driver failed programming external connectivity on endpoint supabase-kong (7f09ca72e1d9903fa54f148810c17a1b50638c12649c1ea3429fe74f881a8810): Bind for 0.0.0.0:8000 failed: port is already allocated
This is my docker-compose.yml file:
https://pastebin.com/QJeB5tpmSamuelTSO
02/09/2023, 5:06 PMjinsley8
02/09/2023, 5:31 PMshoomow
02/09/2023, 5:32 PMrequests
package, the test request being like this:
s.get(f"http://db.[[supabase_host]].supabase.co/storage/v1/object/public/[[bucket_name]]/[[path_to_file]]/pic.png", headers=headers)
where headers
is a dict containing authorization
key with value of Bearer [[supabase_service_key]]
In response, I get a target machine actively refused it
error, and from the details, I can see that the request goes to port 80 (definitely wrong). I tried setting an additional header x-api-port
, as well as passing the port right in the URL, but former has no effect, and latter results in a different exception.
What am I missing?