changemaker.lite/api/prisma/init-nocodb-db.sh
bunker-admin a77306fac2 Initial v2 commit: complete rebuild with unified API + React admin
Phase 1-14 complete:
- Unified Express.js API (TypeScript, Prisma ORM, PostgreSQL 16)
- React Admin GUI (Vite + Ant Design + Zustand)
- JWT auth with refresh tokens
- Influence: Campaigns, Representatives, Responses, Email Queue
- Map: Locations, Cuts, Shifts, Canvassing System
- NAR data import infrastructure (2025 format)
- Listmonk newsletter integration
- Landing page builder (GrapesJS)
- MkDocs + Code Server integration
- Volunteer portal with GPS tracking
- Monitoring stack (Prometheus, Grafana, Alertmanager)
- Pangolin tunnel integration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 10:05:04 -07:00

25 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
###############################################################################
# NocoDB Database Initialization Script
###############################################################################
# This script creates a separate PostgreSQL database for NocoDB's metadata
# to avoid conflicts with Prisma schema management in the main database.
#
# Database: nocodb_meta
# Purpose: Stores NocoDB's internal metadata, views, and configurations
# Runs: Automatically on first PostgreSQL container startup via docker-entrypoint-initdb.d
###############################################################################
set -e
# Create a separate database for NocoDB to avoid Prisma conflicts
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
-- Create NocoDB database if it doesn't exist
SELECT 'CREATE DATABASE nocodb_meta'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'nocodb_meta')\gexec
-- Grant all privileges to the main user
GRANT ALL PRIVILEGES ON DATABASE nocodb_meta TO ${POSTGRES_USER};
EOSQL
echo "NocoDB database 'nocodb_meta' created successfully"