permify icon indicating copy to clipboard operation
permify copied to clipboard

Support postgresql schema for database layout

Open jbergstroem opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Postgres supports schemas as an optional way of delegating access, separating logic and so on. It would be great if permify supported this.

Describe the solution you'd like Support postgres schemas

Describe alternatives you've considered Use a different database or let it live in the public schema with other relations.

jbergstroem avatar Feb 16 '24 17:02 jbergstroem

Hi, any updates on PostgreSQL schema support?

I've been trying to implement this using a custom schema with the pgx connection options. I set the search path in the database URI:

serve --database-engine postgres --database-uri postgres://postgres:postgres@postgres:5432/taskaya?sslmode=disable&search_path=permify&options=-c%20search_path%3Dpermify

While this works for the application queries (they correctly look in the permify schema), the migration tables are still created in the "public" schema. This results in errors since the application can't find the tables created by "goose":

level=ERROR msg="An operational error occurred" error="no rows in result set"
level=INFO msg="finished call" protocol=grpc grpc.component=server grpc.service=base.v1.Data grpc.method=WriteRelationships grpc.method_type=unary peer.address=172.18.0.1:50952 grpc.start_time=2025-03-07T21:01:08Z grpc.code=NotFound grpc.error="rpc error: code = NotFound desc = ERROR_CODE_SCHEMA_NOT_FOUND" grpc.time_ms=2.116

mindcrackx avatar Mar 07 '25 21:03 mindcrackx