diff --git a/.agent/skills/db/SKILL.md b/.agent/skills/db/SKILL.md index 99c8bf5fe1..b1adf6f8e5 100644 --- a/.agent/skills/db/SKILL.md +++ b/.agent/skills/db/SKILL.md @@ -188,7 +188,7 @@ Use these rules for all temporary runtime tables in `runtime_transient`. 4. Cleanup jobs must delete expired rows regularly. 5. For association tables, if the foreign key to the owning runtime record uses `ON DELETE CASCADE`, deleting an expired owner row also removes related association rows automatically. 6. An association table does not require its own `EXPIRY_TIME` column unless the association has an independent expiry lifecycle. -7. When runtime tables are added, removed, or renamed, update both cleanup artifacts: `backend/dbscripts/runtime-transient/postgres-cleanup.sql` and `backend/scripts/cleanup_runtime_transient_db.sh`. +7. When runtime tables are added, removed, or renamed, update both cleanup artifacts: `backend/dbscripts/runtime_transient/postgres-cleanup.sql` and `backend/scripts/cleanup_runtime_transient_db.sh`. ### Expiry Column @@ -212,7 +212,7 @@ WHERE AUTH_ID = $1 AND EXPIRY_TIME > $2 AND DEPLOYMENT_ID = $3 Use the existing cleanup artifacts in this repository: -- `backend/dbscripts/runtime-transient/postgres-cleanup.sql`: defines the PostgreSQL stored procedure `cleanup_expired_runtime_transient_data` (UTC-based cleanup). +- `backend/dbscripts/runtime_transient/postgres-cleanup.sql`: defines the PostgreSQL stored procedure `cleanup_expired_runtime_transient_data` (UTC-based cleanup). - `backend/scripts/cleanup_runtime_transient_db.sh`: provides scheduled/manual cleanup support for PostgreSQL and SQLite. Keep these two files in sync with the current set of runtime tables. @@ -294,6 +294,6 @@ Use a consistent prefix per store and increment the sequence number for each new | Query parameter order | Keep `DEPLOYMENT_ID` as the last parameter in parameterized queries. | | Runtime table expiry column | For runtime owner tables, require `EXPIRY_TIME TIMESTAMP NOT NULL`. | | Association table expiry column | Omit `EXPIRY_TIME` when lifecycle is inherited via `ON DELETE CASCADE`; add it only if association rows expire independently. | -| Expired data cleanup | Use `backend/dbscripts/runtime-transient/postgres-cleanup.sql` and `backend/scripts/cleanup_runtime_transient_db.sh`; keep both updated when runtime tables change. | +| Expired data cleanup | Use `backend/dbscripts/runtime_transient/postgres-cleanup.sql` and `backend/scripts/cleanup_runtime_transient_db.sh`; keep both updated when runtime tables change. | | Query declaration format | Define queries as `DBQuery` values with unique query IDs. | | Table identifier format | Use uppercase table names in double quotes in schema scripts and embedded SQL. | diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 80ddb216ba..1c1e0fd18a 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -9,7 +9,7 @@ backend/cmd/server/ main.go # startup servicemanager.go # calls every internal/*/init.go to register routes bootstrap/flows/ # JSON auth/registration flow definitions (auto-seeded) - repository/ # configdb.db · runtime-transient.db · runtime-persistent.db · entitydb.db created at runtime in the configured data directory (SQLite or Postgres) + repository/ # configdb.db · runtime_transient.db · runtime_persistent.db · entitydb.db created at runtime in the configured data directory (SQLite or Postgres) backend/internal/ authn/ # credential / OTP / passkey / social login oauth/ # OAuth 2.0 + OIDC server (authorize, token, introspect, userinfo, JWKS, DCR) diff --git a/docs/content/community/contributing/contributing-code/debugging.mdx b/docs/content/community/contributing/contributing-code/debugging.mdx index 1887ec4e8c..58a4088c2f 100644 --- a/docs/content/community/contributing/contributing-code/debugging.mdx +++ b/docs/content/community/contributing/contributing-code/debugging.mdx @@ -158,8 +158,8 @@ npm run dev | Database | Path | |----------|------| | Entity DB | `/backend/cmd/server/database/entitydb.db` | -| Runtime-transient DB | `/backend/cmd/server/database/runtime-transient.db` | -| Runtime-persistent DB | `/backend/cmd/server/database/runtime-persistent.db` | +| Runtime-transient DB | `/backend/cmd/server/database/runtime_transient.db` | +| Runtime-persistent DB | `/backend/cmd/server/database/runtime_persistent.db` | | Config DB | `/backend/cmd/server/database/configdb.db` | 5. Click **Test Connection** to verify, then click **Finish** diff --git a/docs/content/guides/deployment-patterns/kubernetes.mdx b/docs/content/guides/deployment-patterns/kubernetes.mdx index ce5feaa8c6..5440eeecf9 100644 --- a/docs/content/guides/deployment-patterns/kubernetes.mdx +++ b/docs/content/guides/deployment-patterns/kubernetes.mdx @@ -220,7 +220,7 @@ Before deploying , prepare the PostgreSQL instance: `GRANT ON ALL TABLES` covers tables that already exist. `ALTER DEFAULT PRIVILEGES` ensures tables created by future migrations are also accessible. 4. Run the initialization scripts to create the schema: - - Apply the database scripts for configdb, runtime_transient, entitydb, and runtime_persistent. + - Apply the database scripts for configdb, runtime_transient, entitydb, and runtime_persistent. For a PostgreSQL setup using Helm, refer to the [Bitnami PostgreSQL Helm Chart](https://bitnami.com/stacks/postgresql). @@ -276,7 +276,7 @@ configuration: sqliteOptions: "_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)" runtime_transient: type: sqlite - sqlitePath: database/runtime-transient.db + sqlitePath: database/runtime_transient.db sqliteOptions: "_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)" entity: type: sqlite @@ -284,7 +284,7 @@ configuration: sqliteOptions: "_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)" runtime_persistent: type: sqlite - sqlitePath: database/runtime-persistent.db + sqlitePath: database/runtime_persistent.db sqliteOptions: "_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)" ``` diff --git a/docs/content/guides/deployment-patterns/openchoreo.mdx b/docs/content/guides/deployment-patterns/openchoreo.mdx index ff2665befc..0ae9beaa9a 100644 --- a/docs/content/guides/deployment-patterns/openchoreo.mdx +++ b/docs/content/guides/deployment-patterns/openchoreo.mdx @@ -202,9 +202,9 @@ Prepare the PostgreSQL instance before deployment: ```bash psql -h -U -d configdb -f backend/dbscripts/configdb/postgres.sql - psql -h -U -d runtime_transient -f backend/dbscripts/runtime-transient/postgres.sql + psql -h -U -d runtime_transient -f backend/dbscripts/runtime_transient/postgres.sql psql -h -U -d entitydb -f backend/dbscripts/entitydb/postgres.sql - psql -h -U -d runtime_persistent -f backend/dbscripts/runtime-persistent/postgres.sql + psql -h -U -d runtime_persistent -f backend/dbscripts/runtime_persistent/postgres.sql ``` :::warning diff --git a/docs/content/guides/getting-started/configuration.mdx b/docs/content/guides/getting-started/configuration.mdx index 1c8298934e..295c830643 100644 --- a/docs/content/guides/getting-started/configuration.mdx +++ b/docs/content/guides/getting-started/configuration.mdx @@ -201,7 +201,7 @@ Stores short-lived runtime data such as authorization codes, authorization reque | Setting | Default | Description | |---------|---------|-------------| -| `database.runtime_transient.sqlite.path` | `database/runtime-transient.db` | SQLite database file path | +| `database.runtime_transient.sqlite.path` | `database/runtime_transient.db` | SQLite database file path | | `database.runtime_transient.sqlite.options` | `_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)` | SQLite connection options | | `database.runtime_transient.sqlite.max_open_conns` | `500` | Maximum number of open connections | | `database.runtime_transient.sqlite.max_idle_conns` | `100` | Maximum number of idle connections | @@ -311,7 +311,7 @@ Stores SSO sessions, revoked tokens, and consent records. This database is requi | Setting | Default | Description | |---------|---------|-------------| -| `database.runtime_persistent.sqlite.path` | `database/runtime-persistent.db` | SQLite database file path | +| `database.runtime_persistent.sqlite.path` | `database/runtime_persistent.db` | SQLite database file path | | `database.runtime_persistent.sqlite.options` | `_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)` | SQLite connection options | | `database.runtime_persistent.sqlite.max_open_conns` | `500` | Maximum number of open connections | | `database.runtime_persistent.sqlite.max_idle_conns` | `100` | Maximum number of idle connections | diff --git a/install/helm/README.md b/install/helm/README.md index 8ba0e4b376..1daa4a0b5d 100644 --- a/install/helm/README.md +++ b/install/helm/README.md @@ -423,7 +423,7 @@ Password fields are available in `configuration.database.config.postgres`, `conf | `configuration.database.config.postgres.max_idle_conns` | Maximum number of idle connections in the pool | `100` | | `configuration.database.config.postgres.conn_max_lifetime` | Maximum lifetime of a connection in seconds | `3600` | | `configuration.database.runtime_transient.type` | Runtime-transient database type (`postgres`, `sqlite`, or `redis`) | `postgres` | -| `configuration.database.runtime_transient.sqlite.path` | SQLite database path (for SQLite only) | `database/runtime-transient.db` | +| `configuration.database.runtime_transient.sqlite.path` | SQLite database path (for SQLite only) | `database/runtime_transient.db` | | `configuration.database.runtime_transient.sqlite.options` | SQLite options (for SQLite only) | `_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)` | | `configuration.database.runtime_transient.sqlite.max_open_conns` | Maximum number of open connections for SQLite | `500` | | `configuration.database.runtime_transient.sqlite.max_idle_conns` | Maximum number of idle SQLite connections | `100` | @@ -464,7 +464,7 @@ Password fields are available in `configuration.database.config.postgres`, `conf | `configuration.database.entity.postgres.max_idle_conns` | Maximum number of idle connections in the pool | `100` | | `configuration.database.entity.postgres.conn_max_lifetime` | Maximum lifetime of a connection in seconds | `3600` | | `configuration.database.runtime_persistent.type` | Runtime-persistent database type (postgres or sqlite). Stores SSO sessions, revoked tokens, and consent records. | `postgres` | -| `configuration.database.runtime_persistent.sqlite.path` | SQLite database path (for SQLite only) | `database/runtime-persistent.db` | +| `configuration.database.runtime_persistent.sqlite.path` | SQLite database path (for SQLite only) | `database/runtime_persistent.db` | | `configuration.database.runtime_persistent.sqlite.options` | SQLite options (for SQLite only) | `_journal_mode=WAL&_busy_timeout=5000&_pragma=foreign_keys(1)` | | `configuration.database.runtime_persistent.sqlite.max_open_conns` | Maximum number of open connections for SQLite | `500` | | `configuration.database.runtime_persistent.sqlite.max_idle_conns` | Maximum number of idle SQLite connections | `100` | diff --git a/install/openchoreo/helm/README.md b/install/openchoreo/helm/README.md index 9804eddc49..7bbe233d2c 100644 --- a/install/openchoreo/helm/README.md +++ b/install/openchoreo/helm/README.md @@ -222,9 +222,9 @@ To promote ThunderID to `staging` or `production`: | `thunderid-component.database.type` | Database engine: `sqlite` or `postgres` | `sqlite` | | `thunderid-component.database.storageSize` | PVC size for SQLite files | `1Gi` | | `thunderid-component.database.config.path` | SQLite config DB path (relative to ThunderID working directory) | `database/configdb.db` | -| `thunderid-component.database.runtime_transient.path` | SQLite runtime-transient DB path | `database/runtime-transient.db` | +| `thunderid-component.database.runtime_transient.path` | SQLite runtime-transient DB path | `database/runtime_transient.db` | | `thunderid-component.database.entity.path` | SQLite entity DB path | `database/entitydb.db` | -| `thunderid-component.database.runtime_persistent.path` | SQLite runtime-persistent DB path | `database/runtime-persistent.db` | +| `thunderid-component.database.runtime_persistent.path` | SQLite runtime-persistent DB path | `database/runtime_persistent.db` | | `thunderid-component.database.host` | PostgreSQL hostname (`postgres` only) | — | | `thunderid-component.database.port` | PostgreSQL port — rendered as an integer in the ConfigMap (`postgres` only) | `5432` | | `thunderid-component.database.config.database` | Config DB name (`postgres` only) | `postgredb` | diff --git a/install/openchoreo/thunderid-oc-resourcetype/README.md b/install/openchoreo/thunderid-oc-resourcetype/README.md index 8cc48fbabd..a8b7ebf73d 100644 --- a/install/openchoreo/thunderid-oc-resourcetype/README.md +++ b/install/openchoreo/thunderid-oc-resourcetype/README.md @@ -53,9 +53,9 @@ resources for services explicitly opted into `mutable`/`composite` stores. ```bash # against each database, run the matching script: backend/dbscripts/configdb/postgres.sql # → configdb - backend/dbscripts/runtime-transient/postgres.sql # → runtime_transient + backend/dbscripts/runtime_transient/postgres.sql # → runtime_transient backend/dbscripts/entitydb/postgres.sql # → entitydb - backend/dbscripts/runtime-persistent/postgres.sql # → runtime_persistent + backend/dbscripts/runtime_persistent/postgres.sql # → runtime_persistent ``` The default `dbType: sqlite` needs no database at all: it uses the