Renaming a Column on the Server

Use the ifnull function in sync rules to output whichever column is available. This would handle both the old and new schema versions:

SELECT IFNULL(description_new, description_old) AS description FROM assets

This may produce a validation error because of a missing column, but PowerSync will still allow the deploy.

One the changes have been deployed and replicated, the old reference can be removed from the sync rules:

SELECT description_new AS description FROM assets

Last updated