reactjsamazon-web-servicesamazon-dynamodbaws-amplify

Renaming AWS GraphQL Schema Types


I have an issue where I created a type called Fixtures but then I realised that it is good practise to always keep it singular with the names as the queries, mutationa and subscriptions that are generated may be plurals.

So How do I change the type name fromFixtures to Fixture

I tried using the instructions to hard reset everything using amplify push --allow-destructive-graphql-schema-updates but it keeps failing with errors saying that some resources exist and those resources are what was generated when i pushed the backend to amplify using amplify push


Solution

  • So I found a solution,

    First I tried to manually delete the table from DynamoDb and also delete the resources that were generated but it didn't work, even told me I had a drift issue. This was driving me crazy.

    But what I did next was to restore everything back as it was, ran amplify push --allow-destructive-graphql-schema-updates but this time I removed the Fixtures type from the schema file.

    This generated everything without the Fixtures and even deleted the table too from Dynamodb. Afterwards, I just added the Fixture type to the list of types in the schema and ran amplify push to generate the table and resources with the right name. A little bit stressful but it does the job