- Applied all 31 pending Supabase migrations successfully
- Fixed 100+ policy/trigger/index duplication errors for shared database
- Resolved foundation_contributions schema mismatch (added user_id, contribution_type, resource_id, points columns)
- Added DROP IF EXISTS statements for all policies, triggers, and indexes
- Wrapped storage.objects operations in permission-safe DO blocks
Developer Platform (10 Phases Complete):
- API key management dashboard with RLS and SHA-256 hashing
- Complete API documentation (8 endpoint categories)
- 9 template starters + 9 marketplace products + 12 code examples
- Quick start guide and SDK distribution
- Testing framework and QA checklist
Database Schema Now Includes:
- Ethos: Artist/guild tracking, verification, tracks, storage
- GameForge: Games, assets, monetization
- Foundation: Courses, mentorship, resources, contributions
- Nexus: Creator marketplace, portfolios, contracts, escrow
- Corp Hub: Invoices, contracts, team management, projects
- Developer: API keys, usage logs, profiles
Platform Status: Production Ready ✅
22 lines
1 KiB
Bash
Executable file
22 lines
1 KiB
Bash
Executable file
#!/bin/bash
|
|
# Find tables with policies referencing user_id but no user_id column in CREATE TABLE
|
|
|
|
grep -n "create table" apply_missing_migrations.sql | while read line; do
|
|
line_num=$(echo "$line" | cut -d: -f1)
|
|
table_name=$(echo "$line" | grep -oP 'create table.*?public\.\K[a-z_]+' || echo "$line" | grep -oP 'CREATE TABLE.*?\K[a-z_]+')
|
|
|
|
if [ ! -z "$table_name" ]; then
|
|
# Get the CREATE TABLE block (next 30 lines)
|
|
table_def=$(sed -n "${line_num},$((line_num+30))p" apply_missing_migrations.sql)
|
|
|
|
# Check if this table has user_id in its definition
|
|
has_user_id=$(echo "$table_def" | grep -c "user_id")
|
|
|
|
# Check if there are policies for this table that reference user_id
|
|
has_policy_user_id=$(grep -c "policy.*on.*${table_name}.*user_id" apply_missing_migrations.sql)
|
|
|
|
if [ "$has_policy_user_id" -gt 0 ] && [ "$has_user_id" -eq 0 ]; then
|
|
echo "⚠️ Table: $table_name - Has policies with user_id but CREATE TABLE has no user_id column"
|
|
fi
|
|
fi
|
|
done
|