You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
It appears that when using PostgreSQL multi schema with @computed the generated SQL uses the default schema, rather than the schema specified in the computedField configuration (ie. selectFrom('myschema.table_name').
That being said, I am struggling to get the same results in my codebase using ORM 3.2.1. It keeps defaulting to the public schema rather than using my configuration.
import { ZenStackClient } from '@zenstackhq/orm';
import { PostgresDialect } from '@zenstackhq/orm/dialects/postgres';
import { schema, type SchemaType } from '../../zenstack/schema';
import { Pool } from 'pg';
export class DbService extends ZenStackClient<SchemaType> {
constructor() {
const computedFields = {
Notice: {
project_number: (eb) =>
eb
.selectFrom('myschema.project')
.select('project.project_number')
.whereRef('project.id', '=', 'project_id')
.limit(1),
source: (eb) =>
eb
.selectFrom('myschema.project')
.select('project.source')
.whereRef('project.id', '=', 'project_id')
.limit(1),
},
};
const options = {
dialect: new PostgresDialect({
pool: new Pool({ connectionString: process.env.POSTGRESQL_DB }),
}),
computedFields,
};
super(schema, options);
}
}
It appears that when using PostgreSQL multi schema with
@computedthe generated SQL uses the default schema, rather than the schema specified in thecomputedFieldconfiguration (ie.selectFrom('myschema.table_name').That being said, I am struggling to get the same results in my codebase using ORM
3.2.1. It keeps defaulting to thepublicschema rather than using my configuration.