Skip to content

Commit

Permalink
feat: flip to use AmplifyTable deploy strategy for data (#654)
Browse files Browse the repository at this point in the history
* chore: bump to latest data cdk construct, and explicitly set deploy strategy for tables

* feat: flip to use AmplifyTable deploy strategy for data

* chore: add changeset

* chore: refresh snapshots and files

* chore: add integration test to verify iterative deploys can succeed
  • Loading branch information
alharris-at authored Nov 15, 2023
1 parent 7641877 commit 688db7b
Show file tree
Hide file tree
Showing 34 changed files with 10,853 additions and 326 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-sheep-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-data': minor
---

Update deployment strategy to use amplify tables, and allow drop/replace semantics for sandbox tables
8 changes: 4 additions & 4 deletions packages/backend-data/src/convert_schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void describe('convertSchemaToCDK', () => {
assert.deepEqual(convertedDefinition.dataSourceStrategies, {
Todo: {
dbType: 'DYNAMODB',
provisionStrategy: 'DEFAULT',
provisionStrategy: 'AMPLIFY_TABLE',
},
});
});
Expand All @@ -48,7 +48,7 @@ void describe('convertSchemaToCDK', () => {
assert.deepEqual(convertedDefinition.dataSourceStrategies, {
Todo: {
dbType: 'DYNAMODB',
provisionStrategy: 'DEFAULT',
provisionStrategy: 'AMPLIFY_TABLE',
},
});
});
Expand All @@ -66,11 +66,11 @@ void describe('convertSchemaToCDK', () => {
assert.deepEqual(convertedDefinition.dataSourceStrategies, {
Todo: {
dbType: 'DYNAMODB',
provisionStrategy: 'DEFAULT',
provisionStrategy: 'AMPLIFY_TABLE',
},
Blog: {
dbType: 'DYNAMODB',
provisionStrategy: 'DEFAULT',
provisionStrategy: 'AMPLIFY_TABLE',
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-data/src/convert_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const convertSchemaToCDK = (
schema: DataSchema
): IAmplifyDataDefinition => {
const dbType = 'DYNAMODB';
const provisionStrategy = 'DEFAULT';
const provisionStrategy = 'AMPLIFY_TABLE';

if (isModelSchema(schema)) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/b45fba916ea00e4066fd3ca9aaa82086097a91664fbaf613680b47e6b741673a.json"
"/1730e1e66f151a5d15fc5696f6de4b5e4d7649a12dc06b6ff7f3b735946b165b.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ApiId"
]
},
"Expires": 1702671883
"Expires": 1702675657
}
},
"amplifyDataGraphQLAPINONEDS684BF699": {
Expand All @@ -64,6 +64,41 @@
"Type": "NONE"
}
},
"amplifyDataAmplifyTableManagerNestedStackAmplifyTableManagerNestedStackResource86290833": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"referencetoamplifytestAppIdtestBranchNamebranch7d6f6c854adataamplifyDataGraphQLAPI8E80FACEApiId": {
"Fn::GetAtt": [
"amplifyDataGraphQLAPI42A6FA33",
"ApiId"
]
}
},
"TemplateURL": {
"Fn::Join": [
"",
[
"https://s3.",
{
"Ref": "AWS::Region"
},
".",
{
"Ref": "AWS::URLSuffix"
},
"/",
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/35e06ca29c28793a345d0a1e4ed0a16bf7bad8a644c30c06a02b4218f7be6aa6.json"
]
]
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"amplifyDataTodoNestedStackTodoNestedStackResource551CEA56": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
Expand All @@ -83,6 +118,12 @@
"DynamoDBEnableServerSideEncryption": {
"Ref": "DynamoDBEnableServerSideEncryption"
},
"referencetoamplifytestAppIdtestBranchNamebranch7d6f6c854adataamplifyDataAmplifyTableManagerNestedStackAmplifyTableManagerNestedStackResource8C0952BCOutputsamplifytestAppIdtestBranchNamebranch7d6f6c854adataamplifyDataAmplifyTableManagerTableD81D951E": {
"Fn::GetAtt": [
"amplifyDataAmplifyTableManagerNestedStackAmplifyTableManagerNestedStackResource86290833",
"Outputs.amplifytestAppIdtestBranchNamebranch7d6f6c854adataamplifyDataAmplifyTableManagerTableManagerCustomProviderframeworkonEventE4FBF539Arn"
]
},
"referencetoamplifytestAppIdtestBranchNamebranch7d6f6c854adataamplifyDataGraphQLAPI8E80FACEApiId": {
"Fn::GetAtt": [
"amplifyDataGraphQLAPI42A6FA33",
Expand Down Expand Up @@ -121,7 +162,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/ee42b8a4399f9441d96d64d8a6914641cd6882338283da6ec16b07cd40ce4a2a.json"
"/7feef61ce2e7746b3d7700aa837fa419f347b204061c8e32f444e10623738309.json"
]
]
}
Expand Down
Loading

0 comments on commit 688db7b

Please sign in to comment.