-
Manual deletion in a transaction - Delete all related records in a single transaction (recommended for most cases)
Every local mutation performed against SQLite via the PowerSync SDK will be returned in
uploadData. As long as you’re using.execute()for the mutation, the operation will be present in the upload queue. -
Triggers - Create triggers on the internal tables (more complex, but more automatic)
You create triggers on the internal tables (not the views defined by the client schema), similar to what is done here.
Example: Manual Transaction
This example from the React Native To-Do List demo app shows how to delete alist and all its associated todos in a single transaction:
Every mutation performed via
.execute() is added to the upload queue and returned in uploadData. PowerSync will also delete local records when your backend performs cascade deletes on the source database (as long as those tables are in the publication).For example, if you delete a record from the local lists table and Supabase cascade deletes a record from the todo table, PowerSync will also delete the local todo record when online.