Skip to content

Conversation

@suddendust
Copy link
Contributor

@suddendust suddendust commented Feb 9, 2026

Config-Driven Timestamp Fields for Flat Collections

Summary

Adds auto-managed createdTime and lastUpdateTime fields for flat PostgreSQL collections, configurable via PostgresClient custom parameters.

Changes

  • Config-driven timestamps: Timestamp column names specified via JSON config:
    customParams {
      timestampFields {
        "createdTsCol" : "createdTime",
        "lastUpdatedTsCol": "lastUpdateTime"}
      }
    }
    
  • Type-aware conversion: Looks up column type from schema and converts appropriately (BIGINT → epoch millis, TIMESTAMPTZjava.sql.Timestamp, etc.)
  • Upsert behavior: createdTime preserved on updates, lastUpdateTime always updated
  • Graceful degradation: Logs warning if config missing; no exception, columns remain NULL

Testing

  • testTimestampsOnCreate - Validates both fields populated on create
  • testTimestampsOnUpsert - Validates createdTime preserved, lastUpdateTime updated
  • testNoExceptionWhenTimestampConfigMissing - Validates graceful handling when config absent

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 87.27273% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.71%. Comparing base (d112d17) to head (f68a964).

Files with missing lines Patch % Lines
...documentstore/postgres/FlatPostgresCollection.java 88.88% 1 Missing and 5 partials ⚠️
...core/documentstore/commons/FlatStoreConstants.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #274      +/-   ##
============================================
+ Coverage     80.65%   80.71%   +0.05%     
- Complexity     1396     1403       +7     
============================================
  Files           240      241       +1     
  Lines          6871     6926      +55     
  Branches        638      646       +8     
============================================
+ Hits           5542     5590      +48     
- Misses          914      916       +2     
- Partials        415      420       +5     
Flag Coverage Δ
integration 80.71% <87.27%> (+0.05%) ⬆️
unit 53.08% <30.90%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@puneet-traceable
Copy link

This will be doable at what level? Per table ?

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