Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .agent/skills/db/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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. |
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
backend/internal/
authn/ # credential / OTP / passkey / social login
oauth/ # OAuth 2.0 + OIDC server (authorize, token, introspect, userinfo, JWKS, DCR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ npm run dev
| Database | Path |
|----------|------|
| Entity DB | `<repo-root>/backend/cmd/server/database/entitydb.db` |
| Runtime-transient DB | `<repo-root>/backend/cmd/server/database/runtime-transient.db` |
| Runtime-persistent DB | `<repo-root>/backend/cmd/server/database/runtime-persistent.db` |
| Runtime-transient DB | `<repo-root>/backend/cmd/server/database/runtime_transient.db` |
| Runtime-persistent DB | `<repo-root>/backend/cmd/server/database/runtime_persistent.db` |
| Config DB | `<repo-root>/backend/cmd/server/database/configdb.db` |

5. Click **Test Connection** to verify, then click **Finish**
Expand Down
6 changes: 3 additions & 3 deletions docs/content/guides/deployment-patterns/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Before deploying <ProductName />, 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 <RepoLink path="/blob/main/backend/dbscripts/configdb/postgres.sql">configdb</RepoLink>, <RepoLink path="/blob/main/backend/dbscripts/runtime-transient/postgres.sql">runtime_transient</RepoLink>, <RepoLink path="/blob/main/backend/dbscripts/entitydb/postgres.sql">entitydb</RepoLink>, and <RepoLink path="/blob/main/backend/dbscripts/runtime-persistent/postgres.sql">runtime_persistent</RepoLink>.
- Apply the database scripts for <RepoLink path="/blob/main/backend/dbscripts/configdb/postgres.sql">configdb</RepoLink>, <RepoLink path="/blob/main/backend/dbscripts/runtime_transient/postgres.sql">runtime_transient</RepoLink>, <RepoLink path="/blob/main/backend/dbscripts/entitydb/postgres.sql">entitydb</RepoLink>, and <RepoLink path="/blob/main/backend/dbscripts/runtime_persistent/postgres.sql">runtime_persistent</RepoLink>.

For a PostgreSQL setup using Helm, refer to the [Bitnami PostgreSQL Helm Chart](https://bitnami.com/stacks/postgresql).

Expand Down Expand Up @@ -276,15 +276,15 @@ 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
sqlitePath: database/entitydb.db
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)"
```

Expand Down
4 changes: 2 additions & 2 deletions docs/content/guides/deployment-patterns/openchoreo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ Prepare the PostgreSQL instance before deployment:

```bash
psql -h <db-host> -U <db-user> -d configdb -f backend/dbscripts/configdb/postgres.sql
psql -h <db-host> -U <db-user> -d runtime_transient -f backend/dbscripts/runtime-transient/postgres.sql
psql -h <db-host> -U <db-user> -d runtime_transient -f backend/dbscripts/runtime_transient/postgres.sql
psql -h <db-host> -U <db-user> -d entitydb -f backend/dbscripts/entitydb/postgres.sql
psql -h <db-host> -U <db-user> -d runtime_persistent -f backend/dbscripts/runtime-persistent/postgres.sql
psql -h <db-host> -U <db-user> -d runtime_persistent -f backend/dbscripts/runtime_persistent/postgres.sql
```

:::warning
Expand Down
4 changes: 2 additions & 2 deletions docs/content/guides/getting-started/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions install/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down Expand Up @@ -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` |
Expand Down
4 changes: 2 additions & 2 deletions install/openchoreo/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
4 changes: 2 additions & 2 deletions install/openchoreo/thunderid-oc-resourcetype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading