Commit 599b95d
feat(gen2-migration): generate per-table stacks for multiple DDB tables (#14688)
* feat: avatar s3 feature for discussions app
* feat(cli): generate per-table stacks for multiple DDB tables
Previously, all DynamoDB tables were placed in a single shared storage
stack, causing conflicts when multiple tables existed. Each DDB table
now gets its own nested stack via backend.createStack('storage<name>'),
matching the Gen1 nested stack naming convention.
Also fixes resolveOutputs() crash when a Gen2 storage stack has no
Outputs section (happens when no cross-stack references exist for a
table).
Closes #14608, #14597
* fix(discussions): replace hand-crafted snapshots with real infrastructure data
Recapture discussions app snapshots from live deployments:
- Gen1: amplify-discussionsblade-blade-4edfd (activity + bookmarks tables)
- Gen2: amplify-d1skq8aomhb772-e2etest-branch (per-table stacks)
Pre-generate inputs use real amplify-pull data for bookmarks resource.
Pre-refactor templates fetched from deployed CloudFormation stacks.
Post-generate and post-refactor regenerated by test framework.
Also adds bookmarks to migration-config.json and fixes snapshot.ts
to use TemplateStage: Original for unprocessed templates.
* docs(discussions): add bookmarks table setup instructions to README
* fix(discussions): sanitize Amplify App ID in Gen2 snapshot files
Replace raw app ID d1skq8aomhb772 with sanitized name 'discussions'
in all snapshot file contents and filenames.
* docs(discussions): add S3 avatars bucket to migration config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(discussions): update snapshots with S3 avatars + bookmarks DDB
Re-deployed discussions app with 3 storage types (activity DDB,
bookmarks DDB, avatars S3) and captured fresh snapshots for all 4
stages. Per-table stacks refactor verified working for both DDB tables.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(cli): disambiguate S3 nested stack from DDB per-table stacks
The S3 forward/rollback refactorers used findNestedStack with a bare
'storage' prefix, which matched DDB per-table stacks (e.g.
'storageactivity') before the S3 stack ('storage0EC3F24A'). Fixed by
using 'storage' + resourceName for Gen1 lookup and a new
findS3NestedStack method that distinguishes the CDK-hashed S3 stack
from lowercase-prefixed DDB stacks for Gen2 lookup.
Also refreshes discussions snapshots from a clean main/gen2-main deploy.
* fix(cli): address PR review comments for per-table stacks
- Replace fragile char-based findS3NestedStack with template-based S3
detection (fetch template, check for AWS::S3::Bucket resource)
- Export findS3NestedStack from storage-forward.ts, import in rollback
- Remove dead STORAGE_RESOURCE_TYPES export
- Remove storage:S3 from validateSingleResourcePerStack (only one
defineStorage() possible)
- Make scopeVarName required (no default) in DynamoDBRenderer
- Set Outputs default empty object in cfn-output-resolver, use
templateOutputs consistently
- Add comments for optional Outputs in cfn-template.ts and resolver
* fix(cli): restore storage:S3 case in validateSingleResourcePerStack
Keep S3 validation as a defensive spot check even though the collision
can't happen in practice (JSON key uniqueness prevents same-name
resources within a category).
* feat(cli): add S3 avatars and bookmarks DDB tests to discussions test script
Extends the discussions gen1 test script to cover all stateful resources
that get refactored during migration: S3 avatars bucket (upload/getUrl/remove)
and bookmarks DynamoDB table (put/get/delete via AWS SDK). Verified with
full forward→rollback→forward round-trip on live app.
* refactor(cli): clean up bookmarks test - shared DDB client, config-based table lookup
Remove ListTablesCommand discovery in favor of reading table name from
amplifyconfiguration.json. Share a single DynamoDBDocumentClient across
all bookmark test functions instead of creating one per call.
* chore(cli): remove dev-only .gitignore from amplify-cli package
Remove .gitignore that ignored local dev helper scripts
(add-bookmarks.ts, deploy-gen1.ts) that no longer exist.
* fix(cli): add typescript devDep to fix typecheck for bundler moduleResolution
backend-only and discussions were missing typescript as a
devDependency, causing npx tsc to fall back to the root
tsc v4.9.5 which doesn't support moduleResolution:"bundler".
Also restores monorepo metadata in discussions snapshot
package.json files.
* fix: use README-specified emailVerificationMessage in discussions snapshots
Replace "Your verification code is {####}" with "Here is your verification code
{####}" to match the discussions README instructions, preventing drift when
snapshots are regenerated.
* fix: replace remaining old verification message in discussions snapshots
* fix: align gen2 branch verification messages with README
* fix: revert SMS verification messages to original values
Only email verification fields should use the README-specified message.
SMS fields should retain their original values.
* fix: remove trailing newlines from parameters files
* fix: remove unnecessary typescript devDependency from migration apps
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent c0e2c09 commit 599b95d
File tree
260 files changed
+13645
-2929
lines changed- amplify-migration-apps
- discussions
- _snapshot.post.generate/amplify
- data
- storage
- _snapshot.post.refactor
- _snapshot.pre.generate
- amplify
- #current-cloud-backend
- api/discussions/build
- auth/discussionsc578c16ec578c16e
- build
- awscloudformation/build
- api/discussions/build
- auth/discussionsc578c16ec578c16e/build
- awscloudformation/build
- function
- fetchuseractivity
- recorduseractivity
- storage
- activity/build
- avatars/build
- bookmarks/build
- function
- fetchuseractivity
- src
- recorduseractivity
- src
- storage
- activity/build
- avatars
- build
- bookmarks
- build
- backend
- api/discussions/build
- auth/discussionsc578c16ec578c16e
- build
- awscloudformation/build
- api/discussions/build
- auth/discussionsc578c16ec578c16e/build
- awscloudformation/build
- function
- fetchuseractivity
- recorduseractivity
- storage
- activity/build
- avatars/build
- bookmarks/build
- function
- fetchuseractivity
- src
- recorduseractivity
- src
- storage
- activity/build
- avatars
- build
- bookmarks
- build
- types
- _snapshot.pre.refactor
- src
- packages/amplify-cli/src
- __tests__/commands/gen2-migration
- generate/amplify
- storage
- refactor
- commands/gen2-migration
- generate/amplify
- storage
- refactor
- resolvers
- storage
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
260 files changed
+13645
-2929
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
172 | 226 | | |
173 | 227 | | |
174 | 228 | | |
| |||
280 | 334 | | |
281 | 335 | | |
282 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
283 | 341 | | |
284 | 342 | | |
285 | 343 | | |
| |||
332 | 390 | | |
333 | 391 | | |
334 | 392 | | |
335 | | - | |
| 393 | + | |
336 | 394 | | |
337 | 395 | | |
338 | 396 | | |
| |||
419 | 477 | | |
420 | 478 | | |
421 | 479 | | |
422 | | - | |
| |||
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
12 | | - | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
39 | 57 | | |
40 | 58 | | |
41 | 59 | | |
| |||
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
This file was deleted.
Lines changed: 0 additions & 12 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
0 commit comments