Comment by znpy
20 hours ago
> Look at all the features supported here:
> https://www.postgresql.org/docs/current/sql-createtable.html
Unironcally, yesterday i was vibe-coding a small app for personal use using Django and was quite shocked to discover that Django's orm does not support something as simple as specifying a database schema other than the default "public" one out of the box.
You either have to add options specific from libpq:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "mydatabase",
"USER": "myuser",
"PASSWORD": "mypassword",
"HOST": "localhost",
"PORT": "5432",
"OPTIONS": {
"options": "-c search_path=myapp,public",
},
}
}
Or you have to do it from the postgresql side:
ALTER ROLE myuser
IN DATABASE mydatabase
SET search_path = myapp, public;
It's not ergonomic at all.
No comments yet
Contribute on Hacker News ↗