Skip to main content

PostgresRelationalParameters

@webda/postgres


Class: PostgresRelationalParameters

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:27

Parameters of the relational store: those of PostgresStore plus the schema layout and lifecycle

Extends​

Implements​

  • RelationalLayoutParameters

Constructors​

Constructor​

new PostgresRelationalParameters(): PostgresRelationalParameters

Returns​

PostgresRelationalParameters

Inherited from​

PostgresParameters.constructor

Properties​

aggregationFallback?​

optional aggregationFallback?: "allow" | "warn" | "deny"

Defined in: packages/core/lib/stores/store.d.ts:281

What to do when an aggregation on this store cannot run natively and must stream every matching object through memory

Default​

"warn"

Inherited from​

PostgresParameters.aggregationFallback


allowIncompatible?​

optional allowIncompatible?: string[]

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:76

Elements whose blocking changes against a live version are accepted (<table>, <table>.<column>, <model> or <model>.<attribute>): the BLOCK becomes a WARN and the version records it in forced

Default​

[]

Implementation of​

RelationalLayoutParameters.allowIncompatible


appVersion?​

optional appVersion?: string

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:70

Version of the application recorded in the Webda/SchemaVersion registry

Default​

the version of package.json

Implementation of​

RelationalLayoutParameters.appVersion


autoCreateTable?​

optional autoCreateTable?: boolean

Defined in: packages/sql/lib/store.d.ts:22

Auto create tables if they do not exist

Default​

true

Inherited from​

PostgresParameters.autoCreateTable


columnNaming?​

optional columnNaming?: "preserve" | "snake_case"

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:43

preserve keeps the field names as column names (quoted camelCase), snake_case converts them

Default​

"preserve"

Implementation of​

RelationalLayoutParameters.columnNaming


database?​

optional database?: SQLDatabase

Defined in: packages/sql/lib/store.d.ts:17

Database

Inherited from​

PostgresParameters.database


extraColumn?​

optional extraColumn?: string | false

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:48

JSON column keeping the properties the model schema does not declare, false to refuse them

Default​

"_extra"

Implementation of​

RelationalLayoutParameters.extraColumn


foreignKeys?​

optional foreignKeys?: boolean

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:53

Create foreign key constraints between the tables of the store

Default​

true

Implementation of​

RelationalLayoutParameters.foreignKeys


foreignKeysToJsonb?​

optional foreignKeysToJsonb?: boolean

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:59

Also create a foreign key to the uuid column of the JSONB table of a model served by a PostgresStore (the Registry) on the same server and database with a table per model; the JSONB table is created at init()

Default​

false

Implementation of​

RelationalLayoutParameters.foreignKeysToJsonb


maxGroups?​

optional maxGroups?: number

Defined in: packages/core/lib/stores/store.d.ts:288

Maximum number of groups an aggregation may produce without LIMIT (or in memory)

Minimum​

1

Default​

10000

Inherited from​

PostgresParameters.maxGroups


models?​

optional models?: string[]

Defined in: packages/core/lib/stores/store.d.ts:246

Models managed by this Store.

Default​

["Webda/RegistryEntry"]

Inherited from​

PostgresParameters.models


noCache?​

optional noCache?: boolean

Defined in: packages/core/lib/stores/store.d.ts:308

Disable default memory cache

Inherited from​

PostgresParameters.noCache


numericAsDecimal?​

optional numericAsDecimal?: boolean

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:64

Store JSON number fields as NUMERIC instead of DOUBLE PRECISION

Default​

false

Implementation of​

RelationalLayoutParameters.numericAsDecimal


postgresqlServer?​

optional postgresqlServer?: ClientConfig | PoolConfig

Defined in: packages/postgres/src/postgresstore.service.ts:43

By default use environment variables

Can be encrypted with webda config encrypt

Secret​

password,connectionString

Inherited from​

PostgresParameters.postgresqlServer


schemaSync?​

optional schemaSync?: SchemaSyncMode

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:38

What init() does with the database schema

  • none: nothing
  • create: create the missing tables, with their indexes and foreign keys
  • alter: create, plus add the missing columns, indexes and foreign keys of the existing tables (never drops, narrows or sets NOT NULL)
  • validate: write nothing, fail when anything is missing or differs

Default​

"create"

Implementation of​

RelationalLayoutParameters.schemaSync


slowQueryLogLevel?​

optional slowQueryLogLevel?: WorkerLogLevel

Defined in: packages/core/lib/stores/store.d.ts:268

Log level used for slow queries

Default​

"WARN"

Inherited from​

PostgresParameters.slowQueryLogLevel


slowQueryMaxLength?​

optional slowQueryMaxLength?: number

Defined in: packages/core/lib/stores/store.d.ts:274

Maximum length of the query string written to logs / events (longer queries are truncated)

Default​

1024

Inherited from​

PostgresParameters.slowQueryMaxLength


slowQueryThreshold?​

optional slowQueryThreshold?: number

Defined in: packages/core/lib/stores/store.d.ts:262

Duration in ms above which a query is considered slow. Set to 0 to disable slow query detection.

Default​

30000

Inherited from​

PostgresParameters.slowQueryThreshold


strict?​

optional strict?: boolean

Defined in: packages/core/lib/stores/store.d.ts:255

Allow to load object that does not have the type data

If set to true, then the Store will only managed the defined _model and no model extending this one

Default​

false

Inherited from​

PostgresParameters.strict


table?​

optional table?: string

Defined in: packages/sql/lib/store.d.ts:13

The table of every model of the store, subclasses and models routed to this store as fallback included (the Webda 3 layout). Without it each model gets its own table (its identifier lowercased with "/" → "_").

Implementation of​

RelationalLayoutParameters.table

Inherited from​

PostgresParameters.table


tables?​

optional tables?: object

Defined in: packages/sql/lib/store.d.ts:27

Per-model table name overrides. Maps a model identifier (e.g. "Webda/User") to a custom table name.

Index Signature​

[modelIdentifier: string]: string

Implementation of​

RelationalLayoutParameters.tables

Inherited from​

PostgresParameters.tables


transaction?​

optional transaction?: SQLTransactionMode

Defined in: packages/sql/lib/store.d.ts:38

Wrap all statements of an operation in a single transaction

  • "none": autocommit per statement
  • "operation": BEGIN on the first statement of an operation, COMMIT when the operation succeeds, ROLLBACK when it fails. Nested operations join the outermost one; transaction: false on an operation opts it out.

Default​

"none"

Inherited from​

PostgresParameters.transaction


transactionIsolation?​

optional transactionIsolation?: PostgresIsolationLevel

Defined in: packages/postgres/src/postgresstore.service.ts:63

Isolation level of the transactions (transaction: "operation" and withTransaction)

Default​

"READ COMMITTED"

Inherited from​

PostgresParameters.transactionIsolation


type​

type: string

Defined in: packages/core/lib/services/serviceparameters.d.ts:9

Type of the service

Inherited from​

PostgresParameters.type


typeCheck?​

optional typeCheck?: object

Defined in: packages/core/lib/stores/store.d.ts:292

Startup check of the stored types: one WARN listing the legacy, untyped and unknown types found

enabled?​

optional enabled?: boolean

Whether enabled is enabled

Default​
true

maxRows?​

optional maxRows?: number

Rows scanned at most by stores without a native count; beyond, the counts are "at least"

Default​
10000

Inherited from​

PostgresParameters.typeCheck


usePool?​

optional usePool?: boolean

Defined in: packages/postgres/src/postgresstore.service.ts:36

Use a shared pool of connections rather than a single client: required by transaction: "operation"

Default​

false

Inherited from​

PostgresParameters.usePool


versionHeartbeat?​

optional versionHeartbeat?: number

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:81

Seconds between two heartbeats of the version in the registry, 0 for none

Default​

60

Implementation of​

RelationalLayoutParameters.versionHeartbeat


versionTtl?​

optional versionTtl?: number

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:86

Seconds after its last heartbeat a version still counts as live

Default​

600

Implementation of​

RelationalLayoutParameters.versionTtl


viewPrefix?​

optional viewPrefix?: string

Defined in: packages/postgres/src/postgresstore.service.ts:52

View name prefix

Default​

""

Pattern​

/^[a-zA-Z_][a-zA-Z0-9_]*$/

Examples​

"app_"
"v_"
"view_"

Inherited from​

PostgresParameters.viewPrefix


views?​

optional views?: string[]

Defined in: packages/postgres/src/postgresstore.service.ts:58

Regexp patterns of model identifiers to include when generating views

Default​

[".*"]

Inherited from​

PostgresParameters.views

Methods​

load()​

load(params): this

Defined in: packages/postgres/src/postgresrelationalstore.service.ts:93

Parameters​

params​

any

raw parameters

Returns​

this

this

Overrides​

PostgresParameters.load


update()​

update(params, delta): this

Defined in: packages/core/lib/application/parameters.d.ts:21

Update parameters and call watchers if a parameter was changed

Parameters​

params​

any

the service parameters

delta​

any

the delta

Returns​

this

this for chaining

Inherited from​

PostgresParameters.update


with()​

with(callback): this

Defined in: packages/core/lib/application/parameters.d.ts:27

Watch for changes on the parameters and call watchers when a parameter is changed

Parameters​

callback​

(params) => void

the callback function

Returns​

this

this for chaining

Inherited from​

PostgresParameters.with