Initial commit - QR Master application
This commit is contained in:
26
docker/init-db.sh
Normal file
26
docker/init-db.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script runs when the PostgreSQL container is first created
|
||||
# It ensures the database is properly initialized
|
||||
|
||||
echo "🚀 Initializing QR Master database..."
|
||||
|
||||
# Create the database if it doesn't exist (already created by POSTGRES_DB)
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
-- Enable required extensions
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
|
||||
|
||||
-- Grant privileges
|
||||
GRANT ALL PRIVILEGES ON DATABASE qrmaster TO postgres;
|
||||
|
||||
-- Set timezone
|
||||
ALTER DATABASE qrmaster SET timezone TO 'UTC';
|
||||
EOSQL
|
||||
|
||||
echo "✅ Database initialization complete!"
|
||||
echo "📊 Database: $POSTGRES_DB"
|
||||
echo "👤 User: $POSTGRES_USER"
|
||||
echo "🌐 Ready to accept connections on port 5432"
|
||||
|
||||
Reference in New Issue
Block a user