Migrate Drive Tables to Cloud SQL

Drive Tables are deprecated as a supported data model type in App Maker. New apps can no longer create Drive Tables, and existing apps should migrate to Google Cloud SQL.

How data is migrated

When you migrate the app from Drive Tables, the data that you see in your preview instance is migrated to the default Cloud SQL database. After migration, all previews of this app share the same Cloud SQL database.

Your deployment database isn't migrated when you migrate your app, only once you republish your app to the deployment. The first time you publish to a deployment after app migration, the deployment is migrated to a new default Cloud SQL database. Each deployment uses a separate Cloud SQL database.

Timestamps

Drive Tables stores dates as timestamps, with no time zone information. When you migrate to Cloud SQL, timestamps are converted to timezone-agnostic MySQL DateTimes. App Maker extracts the date and applies the time zone setting for your app (set in App Settings). For consistency, make sure your app’s time zone is set before you migrate data.

String data

By default, Drive Tables strings are converted to VARCHAR(255). During migration and app deployment, App Maker automatically detects if data does not fit and updates your app to support a longer string.

String data is never truncated or trimmed during migration.

Before you begin

  1. If your domain isn't already using Cloud SQL, ask your G Suite admin to set up your default Cloud SQL database.
  2. Make sure no other developers are working on the app.
  3. Identify and delete any unneeded data in your Drive Tables to make migration quicker and more reliable.
  4. Click Settings settings chevron_right Database and verify that your app is using the default Cloud SQL database. App Maker can't migrate data to a custom Cloud SQL database.
  5. If needed, republish the latest deployment to make sure any pending changes in App Maker are deployed to users.
  6. Test the app to verify the latest deployment works as expected.
  7. Click Settings settings chevron_right Revisions and add a tag to the revision in case you need to revert the migration.
  8. Export your deployment data:

    1. Click Settings settings chevron_right Deployments.
    2. In the row for the most recent deployment, click Down Arrow expand_more to open the deployment settings.
    3. Click Export data. Select the option to export all models and relations data to a sheet.
    4. Repeat the steps for any other deployments.

    You use the sheet to verify the app data after the migration.

Migrate your app to Cloud SQL

  1. Click Data to open your data models.
  2. Click Upgrade to Google Cloud SQL to migrate the models in your app and preview data.
  3. Leave the page open and do not reload or close your browser until the migration is complete. Migration can take up to 3 minutes.

    If your migration doesn’t complete or reports an error, try the migration again. If migration still doesn’t work, contact support.

  4. Preview your app and make sure it works as expected.

  5. Follow the steps in the next section to migrate your deployments to Cloud SQL. Your deployment data is not migrated until you republish to the deployment.

Migrate your deployments to Cloud SQL

  1. Publish the latest revision to your deployment, which triggers the database migration for the deployment.
  2. Leave the page open and do not reload or close your browser until the migration is complete. Migration of each deployment can take up to 3 minutes.
  3. Test the app to make sure it works as expected.
  4. Export your deployment data model again:
    1. Click Settings settings chevron_right Deployments.
    2. In the row for the most recent deployment, click Down Arrow expand_more to open the deployment settings.
    3. Click Export data. Select the option to export all models and relations data to a sheet.
  5. Compare the new sheet to the one you exported before migration.
  6. Add a tag to the revision so you know which was the first to use Cloud SQL.
  7. Repeat the steps for any more deployments.

(Optional) Migrate from default to custom Cloud SQL

After you've migrated your app from Drive Tables to default Cloud SQL, you can move your preview or deployment data from default Cloud SQL to a custom Cloud SQL instance. You might want to use a custom database for your production deployment if you need a high-performance database that can support a lot of users and data or that can be shared between apps.

  1. Publish your app and make sure that it is working correctly. Tag the revision so you know which one was the last to use the default Cloud SQL database in case you need to revert to it.
  2. Export the data from the default Cloud SQL database to Cloud Storage as a SQL dump file. For instructions, see Exporting Data from Cloud SQL.
  3. Prepare your custom Cloud SQL database if you haven't already. For instructions, see Connect your app to a custom Cloud SQL database.
  4. Import the SQL dump file to your custom Cloud SQL database. For instructions, see Importing Data into Cloud SQL.
  5. If you want your preview instances to use the custom Cloud SQL database, update the Cloud SQL database settings for your app:
    1. Click Settings settings chevron_right Database chevron_right Switch to a custom Cloud SQL database.
    2. Enter the address with the format for your instance type:
      • First generationprojectName:instanceName/databaseName
      • Second generationprojectName:regionName:instanceName/databaseName
    3. Click Update.
    4. Preview your app and make sure that it is using the correct data.
  6. If you want a deployment to use the custom Cloud SQL database, update the Cloud SQL database settings for your deployment:
    1. Click Publish chevron_right Edit deployments.
    2. Click the down arrow keyboard_arrow_down chevron_right Edit.
    3. Select Use Custom Cloud SQL database and enter the address with the format for your instance type:
      • First generationprojectName:instanceName/databaseName
      • Second generationprojectName:regionName:instanceName/databaseName
    4. Click Save.
    5. Test the deployment and make sure that it is using the database correctly.
    6. Repeat for any other deployments that you want to use the custom Cloud SQL database.

Revert your app to Drive Tables

If you need to revert to the Drive Tables version of your app:

  1. Click Settings settings chevron_right Revisions.
  2. Point to the revision that last used Drive Tables and click Publish cloud_upload.
  3. To resume developing the Drive Tables revision, click Revert to. This action creates a revision that is a copy of the revision you reverted.