From e3b2d04dbfffb5722a09c7e002ac2fefb724fe9a Mon Sep 17 00:00:00 2001 From: along Date: Mon, 3 Aug 2026 12:06:43 -0700 Subject: [PATCH 1/2] feat(cassandra): add llm_config column to nvcf_api schema Sync the self-hosted nvcf_api keyspace with the managed NVCF API schema, which stores function-level LLM configuration in functions_v3.llm_config. Without the column, a self-hosted NVCF API build that carries the LLM invocation config fails against its own database. Fresh installs get the column from 03_init_tables.up.sql. Existing clusters never replay 03, so 08_add_llm_config.up.sql adds it on upgrade using ADD IF NOT EXISTS, which is a no-op where 03 already created it. With this change the self-hosted schema matches the managed one column for column. Closes #622 Signed-off-by: along --- migrations/cassandra/README.md | 2 +- migrations/cassandra/keyspaces/README.md | 4 ++-- .../cassandra/keyspaces/nvcf_api/03_init_tables.up.sql | 1 + .../cassandra/keyspaces/nvcf_api/08_add_llm_config.up.sql | 6 ++++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 migrations/cassandra/keyspaces/nvcf_api/08_add_llm_config.up.sql diff --git a/migrations/cassandra/README.md b/migrations/cassandra/README.md index 39ae241da..e0dcfd78e 100644 --- a/migrations/cassandra/README.md +++ b/migrations/cassandra/README.md @@ -154,7 +154,7 @@ For a brand-new keyspace, the conventional sequence is: 2. `02_init_roles.up.sql` - creates the application role and grants, with the login password supplied by `${SERVICE_ROLE_PASSWORD}`. 3. `03_init_tables.up.sql` - the canonical schema (UDTs, tables, indexes) for the keyspace. -Subsequent files (`04_*`, `05_*`, `06_*`) are incremental DDL deltas applied as the schema evolves. +Subsequent files (`04_*` and later) are incremental DDL deltas applied as the schema evolves. The `03_init_tables.up.sql` follows a clean-slate model: it is updated in place when the canonical schema changes rather than accumulating `ALTER TABLE` history. Existing clusters apply only the deltas that postdate their last applied migration. diff --git a/migrations/cassandra/keyspaces/README.md b/migrations/cassandra/keyspaces/README.md index 2e08da5d0..9859dc55f 100644 --- a/migrations/cassandra/keyspaces/README.md +++ b/migrations/cassandra/keyspaces/README.md @@ -25,7 +25,7 @@ pinned version reference is bumped accordingly. | `ess_api` | [ess_api/03_init_tables.up.sql](ess_api/03_init_tables.up.sql) | `v0.48.26` | `200fd74d` | | `event_ledger` | [event_ledger/03_init_tables.up.sql](event_ledger/03_init_tables.up.sql) | `0.10.0` | `adc2ff44` | | `nvcf_autoscaler` | [nvcf_autoscaler/03_init_tables.up.sql](nvcf_autoscaler/03_init_tables.up.sql) | `v1.15.0` | `bff903c` | -| `nvcf_api` | [nvcf_api/03_init_tables.up.sql](nvcf_api/03_init_tables.up.sql) | `v1.5.1` | `7a422ff1` | +| `nvcf_api` | [nvcf_api/03_init_tables.up.sql](nvcf_api/03_init_tables.up.sql) | `v1.10.0` | `fcaea0c1` | | `nvct_api` | [nvct_api/03_init_tables.up.sql](nvct_api/03_init_tables.up.sql) | `v1.5.2` | `a0247478` | | `sis_api` | [sis_api/03_init_tables.up.sql](sis_api/03_init_tables.up.sql) | `v1.531.2` | `8a492a2e` | @@ -43,7 +43,7 @@ pinned version reference is bumped accordingly. | `01_init_keyspace.up.sql` | Creates the keyspace with `NetworkTopologyStrategy` replication. Uses `${REPLICA_COUNT}`, which the entrypoint substitutes before migration. | | `02_init_roles.up.sql` | Creates the application role, grants privileges, and sets the service login password via `${SERVICE_ROLE_PASSWORD}`. | | `03_init_tables.up.sql` | Complete canonical schema with all UDTs, tables, and indexes at the pinned upstream version. | -| `04_*`, `05_*`, `06_*` | Incremental deltas for rolling upgrades. These add tables/columns that are not in `03_init_tables.up.sql` at the version that was applied on existing clusters. `ess_api/04_*` is a data seed (deployment-specific values). `sis_api/04_*`-`06_*` and `nvcf_api/04_*`-`05_*` are DDL deltas. | +| `04_*` and later | Incremental deltas for rolling upgrades. These add tables/columns that are not in `03_init_tables.up.sql` at the version that was applied on existing clusters. `ess_api/04_*` is a data seed (deployment-specific values). The `sis_api` and `nvcf_api` deltas are DDL. | --- diff --git a/migrations/cassandra/keyspaces/nvcf_api/03_init_tables.up.sql b/migrations/cassandra/keyspaces/nvcf_api/03_init_tables.up.sql index 3a420af9c..c7aba4242 100644 --- a/migrations/cassandra/keyspaces/nvcf_api/03_init_tables.up.sql +++ b/migrations/cassandra/keyspaces/nvcf_api/03_init_tables.up.sql @@ -82,6 +82,7 @@ CREATE TABLE IF NOT EXISTS nvcf_api.functions_v3 ( container_image TEXT, utils_container_image TEXT, model_specs MAP, + llm_config TEXT, container_args TEXT, container_environment TEXT, helm_chart TEXT, diff --git a/migrations/cassandra/keyspaces/nvcf_api/08_add_llm_config.up.sql b/migrations/cassandra/keyspaces/nvcf_api/08_add_llm_config.up.sql new file mode 100644 index 000000000..d3f4bf72e --- /dev/null +++ b/migrations/cassandra/keyspaces/nvcf_api/08_add_llm_config.up.sql @@ -0,0 +1,6 @@ +-- Add llm_config column to functions_v3, matching the pinned schema version in +-- keyspaces/README.md. +-- Function-level LLM configuration, stored as JSON. Distinct from the per-model +-- configuration embedded in model_specs. + +ALTER TABLE nvcf_api.functions_v3 ADD IF NOT EXISTS llm_config TEXT; From 7bda1b8cde64fbf72a585e03a10a2e567f30f11f Mon Sep 17 00:00:00 2001 From: along Date: Mon, 3 Aug 2026 16:48:53 -0700 Subject: [PATCH 2/2] docs(cassandra): correct delta terminology in migrations README Not every delta is DDL: ess_api/04_* is a data seed. Call the later numbered files incremental migrations and name the exception. Signed-off-by: along --- migrations/cassandra/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/cassandra/README.md b/migrations/cassandra/README.md index e0dcfd78e..2e50974d1 100644 --- a/migrations/cassandra/README.md +++ b/migrations/cassandra/README.md @@ -154,7 +154,7 @@ For a brand-new keyspace, the conventional sequence is: 2. `02_init_roles.up.sql` - creates the application role and grants, with the login password supplied by `${SERVICE_ROLE_PASSWORD}`. 3. `03_init_tables.up.sql` - the canonical schema (UDTs, tables, indexes) for the keyspace. -Subsequent files (`04_*` and later) are incremental DDL deltas applied as the schema evolves. +Subsequent files (`04_*` and later) are incremental migrations applied as the schema evolves. Most are DDL; `ess_api/04_*` is a data seed. The `03_init_tables.up.sql` follows a clean-slate model: it is updated in place when the canonical schema changes rather than accumulating `ALTER TABLE` history. Existing clusters apply only the deltas that postdate their last applied migration.