Skip to content

feat(bb-database): SQL in-place deploy - #1651

Merged
pranavosu merged 5 commits into
mainfrom
feat/bb-database-dsql-upgrade-in-place
Nov 19, 2026
Merged

pranavosu merged 5 commits into
mainfrom
feat/bb-database-dsql-upgrade-in-place

Conversation

@pranavosu

@pranavosu pranavosu commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An app that deployed a SQL block of an earlier release keeps its database when it moves to Database of @aws-blocks/bb-database.

Changes

  • DistributedDatabase: a Database that owns its Aurora DSQL cluster declares the cluster under the logical id of the earlier block, <fullId>DsqlCluster. The same id gives the same cluster.
  • Database of bb-data: LegacyDatabaseCluster declares the Aurora cluster, the secret and the VPC of release 0.5.0 under the same logical ids. Its infrastructure code is that release's, and is frozen. A Database with a new id runs on it.
  • Data API: DatabaseCluster.fromExisting({ dataApi }) reaches an Aurora PostgreSQL cluster through the RDS Data API, with no connection and no VPC wiring. The legacy cluster uses the same engine.
  • Harness: npm run test:upgrade-sql-blocks -- --scenario dsql|aurora deploys the release, upgrades the stack, and compares the resources and the rows.
  • Docs: README sections for the Data API and for the upgrade, a DESIGN section, and two sections in docs/guides/upgrading-older-apps.md.

Compatibility

  • @aws-blocks/bb-database is not published. A stack that was deployed from main with an owned DSQL cluster gets a different logical id, so its next deploy replaces that cluster. Maintainers, please confirm.
  • asUser() is an error on a LegacyDatabaseCluster: the owner of the tables runs the statements there, so row-level policies apply through asRole().
  • New dependency: @aws-sdk/client-rds-data.

Tests

  • Unit: bb-database 372, blocks 630 and 52. All pass.
  • Local E2E: 555 pass, 5 skipped. This run was before the merge of main.
  • Harness, offline against the releases: 10 of 10 for each scenario.
  • Harness on AWS: aurora 13 of 13 on the final code. dsql 12 of 12, before the harness got its scenarios.
  • Not run: the sandbox E2E of comprehensive.

…ase with the same id

A Database that owns its Aurora DSQL cluster declares the cluster under
the logical id <fullId>DsqlCluster, which DistributedDatabase of
@aws-blocks/bb-distributed-data used. CloudFormation then sees one
resource, and the deploy keeps the cluster and its rows. A shared
DatabaseCluster keeps the logical id of its construct path.

- Two owned blocks whose ids give the same logical id fail at synth
  with an error that names both.
- A test on PGlite reads the _migrations table of the earlier block: an
  applied file does not run again, and a new file is recorded.
- test-apps/comprehensive: test:upgrade-distributed-database deploys
  the 0.3.0 release, upgrades the stack to this checkout, and compares
  the cluster identifier and the rows. Its API accepts signed calls
  only.
- docs/guides/upgrading-older-apps.md has the steps.
@pranavosu
pranavosu requested a review from a team as a code owner November 18, 2026 23:38
@pranavosu pranavosu changed the title feat(bb-database): a Database keeps the cluster of a DistributedDatabase with the same id feat(bb-database): keep the database of a SQL block of an earlier release Nov 19, 2026
@pranavosu pranavosu changed the title feat(bb-database): keep the database of a SQL block of an earlier release feat(bb-database): SQL in-place deploy Nov 19, 2026
@pranavosu
pranavosu merged commit 7c1eec5 into main Nov 19, 2026
66 checks passed
@pranavosu
pranavosu deleted the feat/bb-database-dsql-upgrade-in-place branch November 19, 2026 07:47

This branch was previously deployed

2 inactive deployments
e2e — 955a0b06 Deployed Nov 19, 2026 by pranavosu via E2E Teardown Verify #7300
agent-bench — 955a0b06 Deployed Nov 19, 2026 by pranavosu via bench / summary #6350
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.

1 participant