If you already have a Supabase project with the old schema, you'll need to run this migration to update to the new relational structure.
Before running this migration, make sure to:
- Export your existing data from the Supabase dashboard
- Or use the app's export functionality to backup your data
-- Drop old tables and their triggers
DROP TRIGGER IF EXISTS trg_update_current_updated_at ON current_day;
DROP TRIGGER IF EXISTS trg_update_archived_updated_at ON archived_days;
DROP TABLE IF EXISTS current_day;
DROP TABLE IF EXISTS archived_days;Execute the entire supabase/schema.sql file in your Supabase SQL editor.
Make sure RLS is enabled and policies are active:
-- Check that RLS is enabled
SELECT schemaname, tablename, rowsecurity
FROM pg_tables
WHERE schemaname = 'public'
AND tablename IN ('projects', 'categories', 'tasks', 'archived_days', 'current_day');
-- Should show rowsecurity = true for all tables- Create a test user account
- Add some data through the app
- Verify data appears correctly in the database tables
archived_days.tasks- JSONB blob containing all task datacurrent_day.tasks- JSONB blob containing current tasks- Projects and categories stored in localStorage only
taskstable - Individual task records with proper columnsprojectstable - Project definitions with hourly ratescategoriestable - Category definitionsarchived_daystable - Day summaries without embedded taskscurrent_daytable - Current day state without embedded tasks
- Proper Relational Data: Tasks, projects, and categories are now in separate tables
- Better Queries: Can filter and search by project, client, category, etc.
- Data Integrity: Foreign key relationships ensure data consistency
- Performance: Indexed columns for faster queries
- Scalability: Can handle large amounts of data more efficiently
- Check Supabase logs for error details
- Ensure your user has proper permissions
- Try running schema sections one at a time
- Check that localStorage data was present before signing in
- Verify the migration function completed without errors
- Check browser console for migration error logs
- Clear browser cache and localStorage
- Sign out and sign back in
- Check browser developer tools for error messages