Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add imported tables to data #1678

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

feat: add imported tables to data #1678

wants to merge 3 commits into from

Conversation

dpilch
Copy link
Member

@dpilch dpilch commented Jun 25, 2024

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

  • 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.
  • 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.

Copy link

changeset-bot bot commented Jun 25, 2024

🦋 Changeset detected

Latest commit: 95695d8

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

@dpilch dpilch force-pushed the data-migration branch 2 times, most recently from bbf980e to 29958f5 Compare July 15, 2024 22:10
@dpilch dpilch force-pushed the data-migration branch 2 times, most recently from a6d0593 to 5be23fe Compare October 2, 2024 22:37
@dpilch dpilch force-pushed the data-migration branch 2 times, most recently from f0b5392 to 1231027 Compare October 17, 2024 17:24
@dpilch dpilch force-pushed the data-migration branch 2 times, most recently from f1cc470 to 332ad5a Compare December 18, 2024 21:20
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