amplify-backend
amplify-backend copied to clipboard
feat: add imported tables to data
Problem
Gen 1 -> Gen 2 table migration.
Issue number, if available: N/A
Changes
Add new props:
-
importedAmplifyDynamoDBTableMap
- mapping of model name to table name for imported tables. -
importedModels
- List of model names that should be treated as imported. This gives fault tolerance if theimportedAmplifyDynamoDBTableMap
is missing or modified. The deploy will fail if theimportedModels
list does not match models inimportedAmplifyDynamoDBTableMap
.
Usage:
const schema = `
type Blog @model {
title: String
content: String
authors: [String]
}
type ImportedModel @model {
description: String
}
`;
const dataFactory = defineData({
schema,
importedAmplifyDynamoDBTableMap: {
ImportedModel: 'ImportedModel-1234-dev',
},
importedModels: ['ImportedModel'],
});
Corresponding docs PR, if applicable: N/A
Validation
- Unit testing
Checklist
- [x] If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
- [x] If this PR requires a change to the Project Architecture README, I have included that update in this PR.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.