Skip to main content

SQLiteRelationalParameters

@webda/sqlite


Class: SQLiteRelationalParameters

Defined in: sqlite/src/sqliterelationalstore.service.ts:19

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

Extends​

Implements​

  • RelationalLayoutParameters

Constructors​

Constructor​

new SQLiteRelationalParameters(): SQLiteRelationalParameters

Returns​

SQLiteRelationalParameters

Inherited from​

SQLiteStoreParameters.constructor

Properties​

aggregationFallback?​

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

Defined in: 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​

SQLiteStoreParameters.aggregationFallback


allowIncompatible?​

optional allowIncompatible?: string[]

Defined in: sqlite/src/sqliterelationalstore.service.ts:68

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: sqlite/src/sqliterelationalstore.service.ts:62

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: sql/lib/store.d.ts:22

Auto create tables if they do not exist

Default​

true

Inherited from​

SQLiteStoreParameters.autoCreateTable


busyTimeout?​

optional busyTimeout?: number

Defined in: sqlite/src/sqlitestore.service.ts:23

PRAGMA busy_timeout in ms

Default​

5000

Inherited from​

SQLiteStoreParameters.busyTimeout


columnNaming?​

optional columnNaming?: "preserve" | "snake_case"

Defined in: sqlite/src/sqliterelationalstore.service.ts:35

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: sql/lib/store.d.ts:17

Database

Inherited from​

SQLiteStoreParameters.database


extraColumn?​

optional extraColumn?: string | false

Defined in: sqlite/src/sqliterelationalstore.service.ts:40

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: sqlite/src/sqliterelationalstore.service.ts:45

Declare the foreign key constraints between the tables of the store

Default​

true

Implementation of​

RelationalLayoutParameters.foreignKeys


foreignKeysToJsonb?​

optional foreignKeysToJsonb?: boolean

Defined in: sqlite/src/sqliterelationalstore.service.ts:51

Also declare a foreign key to the uuid column of the JSON table of a model served by a SQLiteStore (the Registry) on the same database with a table per model; the JSON table is created at init()

Default​

false

Implementation of​

RelationalLayoutParameters.foreignKeysToJsonb


maxGroups?​

optional maxGroups?: number

Defined in: 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​

SQLiteStoreParameters.maxGroups


models?​

optional models?: string[]

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

Models managed by this Store.

Default​

["Webda/RegistryEntry"]

Inherited from​

SQLiteStoreParameters.models


noCache?​

optional noCache?: boolean

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

Disable default memory cache

Inherited from​

SQLiteStoreParameters.noCache


numericAsDecimal?​

optional numericAsDecimal?: boolean

Defined in: sqlite/src/sqliterelationalstore.service.ts:56

Declare JSON number fields as DECIMAL instead of REAL

Default​

false

Implementation of​

RelationalLayoutParameters.numericAsDecimal


persistence?​

optional persistence?: SQLitePersistence

Defined in: sqlite/src/sqlitestore.service.ts:18

Omitted: in-memory database, lost on stop() (like MemoryStore without persistence) Set: file database, every committed write is durable

Inherited from​

SQLiteStoreParameters.persistence


pragmas?​

optional pragmas?: Record<string, string | number>

Defined in: sqlite/src/sqlitestore.service.ts:27

Extra PRAGMAs run on open, e.g. { cache_size: -64000 }

Inherited from​

SQLiteStoreParameters.pragmas


schemaSync?​

optional schemaSync?: SchemaSyncMode

Defined in: sqlite/src/sqliterelationalstore.service.ts:30

What init() does with the database schema

  • none: nothing
  • create: create the missing tables, with their indexes and inline foreign keys
  • alter: create, plus add the missing columns and indexes of the existing tables (SQLite cannot add a foreign key to an existing table: it is reported)
  • validate: write nothing, fail when anything is missing or differs

Default​

"create"

Implementation of​

RelationalLayoutParameters.schemaSync


slowQueryLogLevel?​

optional slowQueryLogLevel?: WorkerLogLevel

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

Log level used for slow queries

Default​

"WARN"

Inherited from​

SQLiteStoreParameters.slowQueryLogLevel


slowQueryMaxLength?​

optional slowQueryMaxLength?: number

Defined in: 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​

SQLiteStoreParameters.slowQueryMaxLength


slowQueryThreshold?​

optional slowQueryThreshold?: number

Defined in: 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​

SQLiteStoreParameters.slowQueryThreshold


strict?​

optional strict?: boolean

Defined in: 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​

SQLiteStoreParameters.strict


table?​

optional table?: string

Defined in: 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​

SQLiteStoreParameters.table


tables?​

optional tables?: object

Defined in: 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​

SQLiteStoreParameters.tables


transaction?​

optional transaction?: SQLTransactionMode

Defined in: 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​

SQLiteStoreParameters.transaction


type​

type: string

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

Type of the service

Inherited from​

SQLiteStoreParameters.type


typeCheck?​

optional typeCheck?: object

Defined in: 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​

SQLiteStoreParameters.typeCheck


versionHeartbeat?​

optional versionHeartbeat?: number

Defined in: sqlite/src/sqliterelationalstore.service.ts:73

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: sqlite/src/sqliterelationalstore.service.ts:78

Seconds after its last heartbeat a version still counts as live

Default​

600

Implementation of​

RelationalLayoutParameters.versionTtl

Methods​

load()​

load(params): this

Defined in: sqlite/src/sqliterelationalstore.service.ts:85

Parameters​

params​

any

raw parameters

Returns​

this

this

Overrides​

SQLiteStoreParameters.load


update()​

update(params, delta): this

Defined in: 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​

SQLiteStoreParameters.update


with()​

with(callback): this

Defined in: 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​

SQLiteStoreParameters.with