vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
146 stars 53 forks source link

let user specify Postgres schema in the connection parameters. #183

Closed ka-ramba closed 2 years ago

ka-ramba commented 3 years ago

Right now all connections happen to go to the 'public' schema, which is a showstopper in many production environments. I think the Postgres connection string has search_path

mbarnach commented 2 years ago

I see multiple (related) issues to that:

If anybody has a good idea on how we could (safely!) bypass the escaping of names on the SQL requests, I would be happy to look at it :-)

0xTim commented 2 years ago

This was added in the latest version of Fluent. Update to the latest version and then you can add a new static property on your model:

final class MyModel: Model {
  static let schema = "table_name"
  static let space = "schema_name"
  // ...
}

See the docs for more details.