Database Setup
PacBoiler uses Supabase (PostgreSQL) as the database. We use SQL migrations to manage the schema.
1. Access SQL Editor
- Go to your Supabase project dashboard.
- Click on the SQL Editor icon in the left sidebar.
2. Run Migrations
You need to run the migration files included in the supabase/migrations folder of this project in order.
Migration 1: Initial Schema
Copy the contents of supabase/migrations/001_initial_schema.sql and paste it into the SQL Editor. Click Run.
This creates the core infrastructure:
profilestable (linked to auth.users)subscriptionstable (LemonSqueezy integration)webhook_eventstable (idempotency tracking)- Core functions:
handle_new_user,handle_updated_at,is_admin,is_super_admin delete_own_accountfunction for secure user data removal- RLS policies and performance indexes
Migration 2: RBAC Policies
Copy the contents of supabase/migrations/002_rbac.sql and paste it into the SQL Editor. Click Run.
This adds:
- Admin-specific security policies for profiles and subscriptions
- Granular access control for
super_adminroles
Migration 3: Waitlist
Copy the contents of supabase/migrations/003_waitlist.sql and paste it into the SQL Editor. Click Run.
This adds:
waitlisttable for pre-launch signupswaitlist_conversionstable to track conversion metrics- Waitlist management policies and stats functions
Migration 4: Notifications
Copy the contents of supabase/migrations/004_notifications.sql and paste it into the SQL Editor. Click Run.
This adds:
notificationstable for in-app alerts- Helper functions for creating and managing notifications
- Real-time notification tracking
3. Verify Tables
Go to the Table Editor (spreadsheet icon). You should see:
profilessubscriptionswebhook_eventswaitlistwaitlist_conversionsnotifications
4. Promote First Admin
To access the Admin Panel, you need to make yourself a super_admin.
- Sign up for an account in your app (http://localhost:3000/signup).
- Go back to the SQL Editor in Supabase.
- Run the following query (replace with your email):
UPDATE public.profiles
SET role = 'super_admin'
WHERE email = 'your@email.com';Next Steps
Now that the database is ready, let's set up payments.