Error migrating "type does not exist"
im adding more stuff to my db, so i created this type and once i wanted to migrate i got his
the error is pointing out the type i created as lowercase, but its camel cased
the type exist in supabase, so i cant apply my other change because this one keeps on failing
10 Replies
adding capital letters to postgres types is asking for a bad time
if you could port it to
file_type
I would. You'll thank yourself later
same with all your column names, honestly.so i should be moving to snake case for everything ?
ill have to update alot of things, should i drop my supabase and rename everything and push new db schema ?
so even roId should be ro_id?
yes
the reason is that postgres is case sensitive and queries are automatically converted to lower case unless you explicitly specify. It isn't a problem for drizzle, but it will be really annoying if you ever run queries by hand
GitHub
Why can't I use a capitalized table name in my posgres trigger func...
Hi! I'm trying to set up my own public Profile table that holds custom data for my users. Every time a user signs up with Supabase Auth and is INSERTed into auth.users table, I want to run a tr...
also, if you use supabase, I personally recommend writing your migrations / creating your schema with supabase which will let you drop down to raw sql to create row level security policies etc, then run a drizzle kit introspect to generate the drizzle schema from that. We use drizzle + supabase and that's what we do
if you introspect with the camelcase option set, it will generate
columnsNames
in your schema correctly mapped to column_names
in the dbthanks !!
fyi, if you use row level security with supabase, there is a good github discussion on how to implement it so you can have a drizzle client with only access to the current user's visible items, for security
GitHub
[FEATURE]: Support PostgreSQL's Row Level Security (RLS) · Issue #5...
Describe want to want Supabase is really nicely using Row Level Secruity for granular authorization rules. 🔗 Here's the link to their docs: https://supabase.com/docs/guides/auth/row-level-secur...
im going to check it out for sure, the app is on an early stage so we may implement this later, thanks alot
@Pupok Hi there. Although what francis said is true about the fact that using snake case is better, Drizzle aims to support any casing. It'd be nice if you could create an issue on Github so the official team or any advocates can fix this issue later (hopefully soon) 🙂