Skip to content

HCK-18331: add maxTTL to collections - #72

Merged
serhii-filonenko merged 2 commits into
developfrom
feat/HCK-18331-collection-max-ttl
Oct 28, 2026
Merged

serhii-filonenko merged 2 commits into
developfrom
feat/HCK-18331-collection-max-ttl

Conversation

@Sylvie-P

@Sylvie-P Sylvie-P commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Sub-taskHCK-18331 [BBVA][Couchbase7+] Add maxTTL to collections in the CouchbaseV7Plus plugin

## Content

Jira: HCK-18331 (parent HCK-18316)

Collections get a new Max TTL property (seconds), as described in the CREATE COLLECTION docs (WITH clause, Couchbase Server 7.6+, Enterprise Edition).

  • Properties Pane: maxTTL numeric property on the collection, min value -1. Always visible; the tooltip says it needs 7.6+ and Enterprise Edition. No filtering by version or edition: if the server does not support the value, it rejects the statement.
  • Forward-engineering: CREATE COLLECTION ... [IF NOT EXISTS] WITH {"maxTTL": n} when the value is an integer different from 0. Empty or 0 (inherit from bucket) gives no WITH clause, so existing models generate the same script as before.
  • Alter script: created and renamed collections (drop + create) keep their maxTTL.
  • Reverse-engineering from an instance: reads maxExpiry of each collection from getAllScopes(), once per bucket. 0 is not kept in the model.

Out of scope:

  • Reverse-engineering from a N1QL file with a WITH clause (the ANTLR grammar does not support it yet).
  • Changing the maxTTL of an existing collection in the alter script: SQL++ has no ALTER COLLECTION, so nothing is generated (open question in the ticket).

Technical details

  • getCollectionScript gets a maxTTL param, the clause is built in getMaxTTLClause.
  • New clusterHelper.getCollectionsMaxExpiryMap and schemaHelper.addMaxTTLToDbCollectionData. If getAllScopes() fails, the error is logged and RE continues without maxTTL.
  • No test runner in this repo. Checked with a local Node smoke test (empty, 0, 3600, -1, 1.5, with and without IF NOT EXISTS, alter script for an added collection), oxlint (no new error), Prettier and npm run package.
  • Studio feature tests for CouchbaseV7Plus (FE script, alter script, RE on a 7.1.1 Docker instance) should stay green since models without maxTTL are unchanged. Studio tests covering maxTTL will come in a second PR, after this plugin is published.
  • To check manually: RE on a 7.6 Enterprise instance, especially that the bundled SDK returns -1 for "never expire".

Made with Cursor

Add a maxTTL property (seconds) on collections. Forward-engineering and
the alter script generate CREATE COLLECTION ... WITH {"maxTTL": n} after
IF NOT EXISTS when the value is set and not 0. Reverse-engineering from an
instance reads maxExpiry of each collection.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Sylvie-P Sylvie-P self-assigned this Oct 27, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud

Copy link
Copy Markdown

@serhii-filonenko
serhii-filonenko merged commit 65e3950 into develop Oct 28, 2026
7 checks passed
@serhii-filonenko
serhii-filonenko deleted the feat/HCK-18331-collection-max-ttl branch October 28, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants