PostgresError: relation "public.artist" does not exist
Hi, I'm new to drizzle. I am getting this error while trying to apply migrations,
69 Replies
I found this, https://github.com/t3-oss/create-t3-turbo/issues/511
which said to remove
s
from table names, which I already tried but no luck.GitHub
bug: drizzle adapter with postgres ends with `error: relation "t3tu...
Provide environment information System: OS: Windows 10 10.0.25300 CPU: (16) x64 AMD Ryzen 7 6800HS with Radeon Graphics Memory: 12.63 GB / 31.26 GB Binaries: Node: 20.5.1 - ~\AppData\Local\Volta\to...
I have also tried creating,
then replacing all
pgTable
to schema.table
, and I get this error,
Can anyone help with this?You are trying to apply a migration to a database that is not in the state the migration script expects
You might have dropped tables or otherwise changed the structure manually?
I have tried deleting the migration directory and DB entirely and start from scratch multiple times still same error.
If you deleted the migration directory, you should generate a new migration. You also have to make sure you drop the __drizzle_migrations table from the database as well
Just so you know, you should not delete those files manually. There is a drop command when you want to start over
I use use docker for
postgresql
and I ran docker system prune -fa
to delete the container, volume and all, and also delete the migrations
directory. So its almost like nothing ever happened..
after this I have to generate the migration again and then run migrate.
Yes, I am aware I am only doing this because ATM its not working.youre creating a schema... but are you also exporting it?
if you dont export it like table defintions, it won't get created, thus you see the error youre getting
What do you mean by exporting?
these are the 2 commands I run,
here is my
migrate.ts
file,
you wrote this line
then tried to add a table to it... you would need
ATM I am not using
pgSchema
I am using pgTable()
But I can try using pgSchema
again with export
.in the last error log you posted that was the issue
Yes, I said I tried that, and that also causes error.
OK,
works..
Why does directly using
pgTable
not work?it does... but you were using a new schema in the second example you posted.. which needed to be created
after every change I made I deleted the migrations directory and docker container hosting postgres DB.
and ran generate and migrate after that..