amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

feat: add imported tables to data

Open dpilch opened this issue 1 year ago • 1 comments

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 the importedAmplifyDynamoDBTableMap is missing or modified. The deploy will fail if the importedModels list does not match models in importedAmplifyDynamoDBTableMap.

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.

dpilch avatar Jun 25 '24 14:06 dpilch

🦋 Changeset detected

Latest commit: 21be576c49b7aa4f358e5840e5ccd9e1ca19d17d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@aws-amplify/backend-data Minor
@aws-amplify/backend Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 25 '24 14:06 changeset-bot[bot]