If you're setting up the database for the first time:
- Go to your Supabase dashboard: https://supabase.com/dashboard
- Select your project
- Click "SQL Editor" in the left sidebar
- Click "New Query"
- Copy the entire contents of
supabase-schema.sql - Paste into the SQL Editor
- Click "Run" (or press Ctrl+Enter)
That's it! All tables, indexes, and triggers will be created.
If you've already run migrations, verify everything is correct:
-- Check all tables exist
SELECT tablename
FROM pg_tables
WHERE schemaname = 'public'
ORDER BY tablename;
-- Should return:
-- AgentLog
-- Escrow
-- Feedback
-- IterationPlan
-- Milestone
-- TransactionLog
-- User
-- Verify User table has NO 'role' column
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'User';
-- Should NOT include 'role' in the list
-- Verify Milestone table has IPFS fields
SELECT column_name
FROM information_schema.columns
WHERE table_name = 'Milestone'
AND column_name LIKE 'submission%';
-- Should return:
-- submissionCid
-- submissionFilename
-- submissionSize
-- submissionTxHash
-- submissionUrl-
User - User profiles (role-agnostic)
- No static role column
- Roles computed dynamically based on activity
-
Escrow - Escrow contracts between clients and freelancers
- Tracks smart contract IDs
- Links to blockchain transactions
-
Milestone - Individual milestones within escrows
- Includes IPFS fields for work submissions
- Tracks all transaction hashes
-
Feedback - Dual review system
- Both client and freelancer can review each other
- One review per role per milestone
-
TransactionLog - Blockchain transaction history
- Tracks all on-chain transactions
- Links to escrows and milestones
-
AgentLog - Automated agent actions
- Auto-approval tracking
- Event synchronization logs
-
IterationPlan - User feedback and feature requests
- Tracks improvement suggestions
- Priority management
✅ Role-Agnostic Architecture
- Users can be both clients and freelancers
- Roles computed dynamically from milestone activity
- No static role column in User table
✅ IPFS Integration
submissionCid- IPFS Content IdentifiersubmissionUrl- Gateway URL to access contentsubmissionFilename- Original filenamesubmissionSize- File size in bytes
✅ Smart Contract Tracking
- All transaction hashes stored
- Links to Stellar Explorer
- Supports both real and mock transactions
✅ Dual Review System
- Clients review freelancers
- Freelancers review clients
- 5-star rating system
- Public feedback display
This is normal if tables already exist. The schema uses CREATE TABLE IF NOT EXISTS, so it's safe to run multiple times.
This means your database is already up to date. No action needed.
If IPFS fields are missing from Milestone table, run:
ALTER TABLE "Milestone"
ADD COLUMN IF NOT EXISTS "submissionCid" TEXT,
ADD COLUMN IF NOT EXISTS "submissionUrl" TEXT,
ADD COLUMN IF NOT EXISTS "submissionFilename" TEXT,
ADD COLUMN IF NOT EXISTS "submissionSize" INTEGER;If the role column still exists, remove it:
ALTER TABLE "User" DROP COLUMN IF EXISTS "role";Make sure your backend .env file has:
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_keyTest your database connection:
curl http://localhost:3001/healthShould return:
{
"status": "healthy",
"database": "PostgreSQL"
}If you encounter issues:
- Check Supabase dashboard for error messages
- Verify environment variables are correct
- Ensure service role key (not anon key) is used
- Check backend logs for connection errors
- Location:
backend/supabase-schema.sql - Status: Complete and up-to-date
- Last Updated: February 24, 2026
- Migrations: All consolidated into single file