Specifying PostgreSQL Schema

With using Kysely and PostgreSQL with better-auth, is there a way to explicitly set the schema for the tables to be created on. I've tried this,
const pool = new Pool({
connectionString: `postgresql://${DB_CONNECTION_STRING}`,
options: "-c search_path=auth",
});

export const auth = betterAuth({
database: pool,
});
const pool = new Pool({
connectionString: `postgresql://${DB_CONNECTION_STRING}`,
options: "-c search_path=auth",
});

export const auth = betterAuth({
database: pool,
});
which doesn't seem to help. I also tried creating a better_auth user which is explicitly scoped to the auth schema and nothing else, and I get this error when trying to migrate/generate with the cli.
pnpx @better-auth/cli@latest generate
preparing schema...node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^

error: permission denied for schema public
pnpx @better-auth/cli@latest generate
preparing schema...node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^

error: permission denied for schema public
it seems like it keeps trying to go back to the schema public.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?