Moving local notes into a Jurnal PKL account
The first version of Jurnal PKL stored notes in the browser's IndexedDB. The current repository also uses Google sign-in and Supabase so journals, Product Knowledge notes, and memories can belong to an account. That change raises a practical question: what should happen to older local notes when someone signs in?
Migrate only when the cloud account is empty
After sign-in, migrateLocalToCloud reads journals, product notes, memories, and settings from IndexedDB. Before uploading, it checks whether the Supabase account already has journals, product notes, or memories.
If any of those data types already exist, the local migration is skipped. This reduces the risk of overwriting account data already used on another device, but it does not merge two sets of records automatically.
Keep account data isolated
Uploaded records include a user_id. The Supabase schema enables Row Level Security on the journal, product-note, memory, and settings tables, with policies that scope access to the account. Memory photos are stored in Storage under a path that includes the account ID.
This matters because the application contains personal notes. Authentication alone is not enough; database and file policies also need to restrict which records each account can read or change.
What still needs work
The migration is conservative: an empty account receives browser data, while an account that already has data skips the process. There is no screen yet to review differences, choose which records to merge, or retry migration selectively. That is a useful next step for the project.
The repository also provides a JSON backup export. A backup gives users a recoverable copy, while migration handles older data when an account is first used.
Jurnal PKL is a portfolio project. See the Jurnal PKL project page or try the application.
