SupabaseS
Supabase•4y ago
wuh

Inserting dummy data from seed.sql

I'm using the Supabase CLI, trying to insert some dummy data through seed.sql when local hosting and wondering what I'm doing wrong.

create table public.foobar
(
    id          uuid primary key         default gen_random_uuid(),
    inserted_at timestamp with time zone default timezone('utc'::text, now()) not null,
    name        text    not null
);

insert into public.foobar (id, name) values ('5e0ade32-e006-402c-a8da-50eb455560b4', 'Test name');


When I run supabase db reset I get the following error: {"Type":"ErrorResponse","Severity":"ERROR","SeverityUnlocalized":"ERROR","Code":"42P01","Message":"relation \"public.foobar\" does not exist","Detail":"","Hint":"","Position":13,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"parse_relation.c","Line":1360,"Routine":"parserOpenTable","UnknownFields":null}

However if I run the same code in the Supabase SQL Editor with a clean database it runs fine and inserts the dummy data as intended.

If I comment out the "insert into"-line, the table is created and I can later do the insert through the SQL Editor without problems.

What am I doing wrong? 🙂
Was this page helpful?