The database schema name of the entity
Optionalconfig: {Optional config override; falls back to the module-level configInfo
OptionaladditionalSchemaInfo?: stringPath to JSON file containing soft PK/FK definitions for tables without database constraints
OptionaladvancedGeneration?: OptionalcodegenPool?: {Optional CodeGen-time database connection pool configuration.
Per-provider applicability — not all fields apply to both providers today:
| Field | SQL Server | PostgreSQL |
|---|---|---|
statementTimeoutMs |
✅ mssql requestTimeout |
✅ libpq -c statement_timeout |
max / min / idleTimeoutMillis / connectionTimeoutMillis |
❌ ignored | ✅ pg.Pool config |
ssl |
❌ ignored (SQL Server uses dbTrustServerCertificate + mssql's own SSL) |
✅ pg.Pool ssl |
The PG-only pool-sizing knobs reflect the asymmetry between mssql and pg.Pool
configurability today; they'll converge in a follow-up. When omitted, each
driver's own defaults apply (mssql: 10 max; PGConnectionManager: 20 max, 2 min).
For runtime (MJAPI) pool settings, see
@memberjunction/server's databaseSettings.connectionPool — that is
a separate, long-lived service pool and is independent of CodeGen.
OptionalconnectionTimeoutMillis?: numberPostgreSQL only today. New-connection acquisition timeout in ms.
OptionalidleTimeoutMillis?: numberPostgreSQL only today. Idle timeout in ms before a pooled connection is closed.
Optionalmax?: numberPostgreSQL only today. Max pool connections; pg.Pool default 20 when unset.
Optionalmin?: numberPostgreSQL only today. Min idle connections kept open; pg.Pool default 2.
Optionalssl?: boolean | Record<string, unknown>PostgreSQL only. SSL configuration for the codegen pool. Defaults to false
(matches the pre-multi-provider-refactor inline pg.Pool behavior that ran
codegen plaintext locally). Set to true for managed PostgreSQL with default
trust (e.g. AWS Aurora rds.force_ssl=1); pass an object for full control
(e.g. { rejectUnauthorized: true, ca: <CA bundle> }).
Note: the runtime MJAPI pool (databaseSettings.connectionPool) has its own
SSL handling that defaults ON in NODE_ENV=production — this field only
governs the short-lived codegen pool.
OptionalstatementTimeoutMs?: numberPer-statement timeout in milliseconds, applied to both providers:
requestTimeout on the pool config.
Takes precedence over the legacy top-level dbRequestTimeout when both
are set; falls back to dbRequestTimeout (and ultimately mssql's 120000ms
default) when unset.-c statement_timeout=<ms>
(carried in pg's connection startup packet), so every backend — including the
verify-SELECT-1 connection — honors it from the very first query. When unset,
PostgreSQL applies no statement timeout (its default).OptionaldbInstanceName?: string | nullDatabase platform: 'sqlserver' or 'postgresql'.
OptionaldbRequestTimeout?: numberLegacy — SQL Server request timeout in milliseconds applied to the
CodeGen connection pool. Set in mj.config.cjs or via the
MJ_CODEGEN_REQUEST_TIMEOUT environment variable when long-running CodeGen
steps (e.g. spUpdateExistingEntityFieldsFromSchema) exceed the default of
120000 (2 minutes).
Prefer the cross-platform codegenPool.statementTimeoutMs for new
configs — it applies to both SQL Server (as requestTimeout) and
PostgreSQL (as the per-connection statement_timeout GUC). When both are
set on a SQL Server install, codegenPool.statementTimeoutMs wins;
dbRequestTimeout remains as a backward-compatible fallback so existing
configs keep working unchanged.
Entity and field name normalization settings for ALL CAPS database identifiers
Additional domain-specific words for the compound word splitter
Normalize ALL CAPS table/entity names to Title Case (e.g., PAYMENT -> Payment). Default: true
Normalize ALL CAPS column/field names the same way. Default: true
Split compound ALL CAPS words using dictionary matching (e.g., INDIVIDUALDESIGNATION -> Individual Designation). Default: true
Force regeneration of all stored procedures
Force regeneration of base views
Force regeneration of all SQL objects even if no schema changes are detected
OptionalentityWhereClause?: stringOptional SQL WHERE clause to filter entities for forced regeneration Example: "SchemaName = 'dbo' AND Name LIKE 'User%'"
Force regeneration of full text search components
Force regeneration of indexes for foreign keys
Force regeneration of spCreate procedures
Force regeneration of spDelete procedures
Force regeneration of spUpdate procedures
OptionalincludeSchemas?: string[]Opt-in POSITIVE scope list. When set (non-empty), CodeGen processes ONLY these schemas — every
other schema present in the DATABASE is treated as excluded, including schemas MJ has never seen
before. It is pure sugar over excludeSchemas: it is resolved into excludeSchemas (see
applyIncludeSchemaScope) before metadata management and again before file generation, so
nothing downstream changes. In-scope ⇔ named in includeSchemas AND not in excludeSchemas
(include shrinks the addressable space; exclude overlays on top). No hidden auto-includes — a
schema, including the MJ core schema, is in scope ONLY if listed explicitly. Leave
undefined/empty for the classic exclude-only behavior (unchanged).
Primary use: scope an Open App's CodeGen to just its own schema without hand-maintaining an exclude list naming every other installed app — a list that is O(N²) to maintain and, more importantly, cannot name schemas the app does not know about (such as a client's own schemas in a deployed instance).
Whether to also log to console
Whether logging is enabled
File path for log output
Number of metadata INSERT statements CodeGen joins into a single batched
round-trip when syncing newly-discovered entity fields into the metadata
tables (createNewEntityFieldsFromSchema). Each row's INSERT SQL is
unchanged and conflict-guarded; this knob only controls how many are
terminated, joined, and sent — plus logged to the migration file — per DB
round-trip.
Larger values mean fewer round-trips but a larger SQL string per batch;
smaller values trade throughput for smaller batches. These are independent
statements (not a multi-row VALUES), so no SQL Server row/parameter limit
bounds the value. Defaults to 250, a good balance on large-schema installs
(thousands of tables). Applies to both SQL Server and PostgreSQL.
Per-schema overrides for the AllowCaching default. When CodeGen creates a new
Entity row, the schema is matched (case-insensitive) against this list and the
matching entry's AllowCaching value wins over the global AllowCaching default.
Schema names support the ${mj_core_schema} placeholder. Defaults to enabling
caching for the MJ core schema.
OptionalnewUserSetup?: OptionaloutputCode?: string | nullIf set to true, then we append to the existing file, if one exists, otherwise we create a new file.
If true, all mention of the core schema within the log file will be replaced with the flyway schema, ${flyway:defaultSchema}
Whether or not sql statements generated while managing metadata should be written to a file
OptionalfileName?: stringOptional, the file name that will be written WITHIN the folderPath specified.
The path of the folder to use when logging is enabled. If provided, a file will be created with the format "CodeGen_Run_yyyy-mm-dd_hh-mm-ss.sql"
If true, scripts that are being emitted via SQL logging that are marked by CodeGen as recurring will be SKIPPED. Defaults to false
OptionalschemaPlaceholders?: { placeholder: string; schema: string }[]Optional array of schema-to-placeholder mappings for Flyway migrations. Each mapping specifies a database schema name and its corresponding Flyway placeholder. If not provided, defaults to replacing the MJ core schema with ${flyway:defaultSchema}.
Example: [ { schema: '__mj', placeholder: '${mjSchema}' }, { schema: '__BCSaaS', placeholder: '${flyway:defaultSchema}' } ]
Optionalstartup?: { mode?: "full" | "task" }Startup mode for engine pre-warm during CodeGen's provider bootstrap: 'full' pre-warms all
The npm package name to use for importing entities from this schema
Resolves the entity package name for a given database schema.
When
entityPackageNameis a plain string (legacy/default), all non-core schemas use that single package. When it is aRecord<string, string>, each schema is mapped to its own package (used by OpenApp projects with multiple installed apps).