Skip to content

Commit

Permalink
Fixed updating schema when moving todos to synced table
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriztiaan committed Sep 26, 2024
1 parent 9dea1b9 commit 9724e6c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export async function switchToSyncedSchema(db: AbstractPowerSyncDatabase, userId
[userId]
);

await tx.execute('INSERT INTO todos SELECT * FROM inactive_local_todos');
await tx.execute(
'INSERT INTO todos(id, list_id, created_at, completed_at, description, completed, created_by) SELECT id, list_id, created_at, completed_at, description, completed, ? FROM inactive_local_todos',
[userId]
);

// Delete the local-only data.
await tx.execute('DELETE FROM inactive_local_todos');
Expand Down

0 comments on commit 9724e6c

Please sign in to comment.