Page updated Jan 16, 2024

Schema updates

Amplify iOS v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Swift to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

Amplify libraries should be used for all new cloud connected applications. If you are currently using the AWS Mobile SDK for iOS, you can access the documentation here.

Update the schema

Edit the schema and re-run amplify codegen models.

1enum PostStatus {
2 ACTIVE
3 INACTIVE
4 STAGED # new enum value
5}
6
7type Post @model {
8 id: ID!
9 title: String!
10 rating: Int!
11 status: PostStatus!
12}

This will evaluate the changes and create a versioned hash if any changes are detected which impact the underlying on-device storage structure. For example, types being added/deleted or fields becoming required/optional. DataStore evaluates this version on startup and if there are changes the local items on device will be removed and a full sync from AppSync will take place if you are syncing with the cloud.

Local migrations

Local migrations (i.e. migrations controlled by the developer) on device are not currently supported. Therefore, your local data will be lost when the schema changes.

If you are syncing with the cloud the structure and items of that data in your AppSync backend will not be touched as part of this process.