Migrate database from MySQL to Supabase PostgreSQL

- Added @supabase/supabase-js client library
- Rewrote database.js to use Supabase API
- Updated server.js health check for Supabase
- Updated db.config.example.js with Supabase format
- Created comprehensive SUPABASE_SETUP.md guide
- Added SQL schema files for easy deployment
- Updated README_DB_CONFIG.md for Supabase

Benefits:
- Managed PostgreSQL database
- Built-in Row Level Security
- Real-time capabilities
- Easy monitoring via dashboard
- Free tier for development
This commit is contained in:
2025-12-21 15:40:57 +11:00
parent 5238fc8d22
commit 054cbf3e77
9 changed files with 872 additions and 276 deletions

View File

@@ -1,13 +1,18 @@
// Database Configuration File
// IMPORTANT: This file contains sensitive credentials and should NEVER be committed to git
// Copy this file to db.config.js and update with your actual database credentials
// Database Configuration File - EXAMPLE
// Copy this file to db.config.js and fill in your actual Supabase credentials
// DO NOT commit db.config.js to git - it's in .gitignore
// Supabase Configuration
// Get these values from your Supabase project dashboard:
// 1. Go to https://app.supabase.com
// 2. Select your project
// 3. Go to Project Settings → API
module.exports = {
host: 'your-database-host.com',
user: 'your-database-username',
password: 'your-secure-password',
database: 'your-database-name',
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
supabaseUrl: 'https://xxxxxxxxxxxxx.supabase.co', // Your Supabase project URL
supabaseAnonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...', // Your Supabase anon/public key
supabasePassword: 'your_database_password_here', // Your database password
// Optional: Direct PostgreSQL connection string
// Found in Project Settings → Database → Connection String
postgresConnectionString: 'postgresql://postgres:your_password@db.xxxxxxxxxxxxx.supabase.co:5432/postgres'
};