Deploying the Schema

After you finalize your schema and test your app in the development environment, you are ready to deploy the schema to production. Deployment promotes the schema to the production environment, but it doesn’t copy the records in the development environment to the production environment. Therefore, after deployment, populate the production environment with records as needed. Then test your app in the production environment. You can continue making changes to the schema in the development environment, but after deploying the schema, you are limited to creating record types and adding fields. Indexes are part of the schema so need to be deployed similar to record type changes. The next time you deploy the development schema, the changes are merged with the production schema.

You must have privileges to edit the production environment to perform the tasks in this chapter. If you are an individual, you are the team admin and have these privileges. Otherwise, ask your team admin to perform these steps for you, or to grant you the Edit Production privilege, as described in Assign Privileges to Other Team Members.

After deploying the schema, upload your app to iTunes Connect, as described in Uploading Your App to iTunes Connect in App Distribution Guide, and for iOS and tvOS apps, distribute your app for testing using TestFlight, as described in Distributing Your App Using TestFlight (iOS, tvOS, watchOS). When you are ready to submit your app to the store, read Submitting Your App.

Deploy the Development Schema to Production

The first time you deploy your app, CloudKit copies the container schema to the production environment. This includes the record types, security roles, and subscription types, but not the records that you created in the development environment. Once you deploy your schema to the production environment, you can’t delete record types and fields that were deployed in the development environment.

To deploy a schema to production

  1. In CloudKit Dashboard, click "Deploy to Production…” button.

  2. Review the changes that are going to be deployed.

  3. Click “Deploy Changes.”

Verify Your Steps

Verify that the schema was copied to the production environment.

To view the production schema and data

  1. Click Data in the Production Environment.

  2. Click Record Types in the tab bar.

  3. Select the record type you want to view.

Assign Privileges to Other Team Members

For organizations, you can delegate some of the responsibilities of deploying your CloudKit app by changing team member privileges, shown below.

Privilege

Description

Manage Team

Can change the privileges of other team members, except the team agent. The team agent always has all privileges.

Edit Development

  • Can edit the development schema by using CloudKit Dashboard.

  • Can view records in development.

Edit Production

  • Can deploy the development schema to production.

  • Can view the production schema.

  • Can view and edit records in production.

You set the team member privileges separately for each container. The privileges don’t apply to all containers belonging to a team.

To grant privileges to team members

  1. In CloudKit Dashboard, within the apppropriate container, click “Container Permissions…” in the upper right corner.

  2. In the row of the team member and Privileges column, select the privileges you want to grant to the team member.

    If a privilege can’t be changed or you don’t have permission to change it, the checkbox is disabled.

Recap

In this chapter you learned how to deploy your development schema to the production environment and how to keep it up to date as you continue developing your app.