Files
rail-game/infra/postgres/initdb/02-create-databases.sh
zwitschi fc1e874309
Some checks failed
Backend CI / lint-and-test (push) Failing after 2m15s
Frontend CI / lint-and-build (push) Successful in 1m1s
feat: Initialize frontend and backend structure with essential configurations
- Added TypeScript build info for frontend.
- Created Vite configuration for React application.
- Implemented pre-commit hook to run checks before commits.
- Set up PostgreSQL Dockerfile with PostGIS support and initialization scripts.
- Added database creation script for PostgreSQL with necessary extensions.
- Established Python project configuration with dependencies and development tools.
- Developed pre-commit script to enforce code quality checks for backend and frontend.
- Created PowerShell script to set up Git hooks path.
2025-10-11 15:25:32 +02:00

27 lines
739 B
Bash

#!/usr/bin/env bash
set -e
psql_cli=("${psql[@]}")
if [[ ${#psql_cli[@]} -eq 0 ]]; then
psql_cli=(psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --no-password)
fi
"${psql_cli[@]}" --dbname="$POSTGRES_DB" <<-EOSQL
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
EOSQL
existing_db=$("${psql_cli[@]}" --dbname=postgres -tAc "SELECT 1 FROM pg_database WHERE datname = 'railgame_test';")
if [[ "$existing_db" != "1" ]]; then
"${psql_cli[@]}" --dbname=postgres <<-EOSQL
CREATE DATABASE railgame_test OWNER ${POSTGRES_USER};
EOSQL
fi
"${psql_cli[@]}" --dbname=railgame_test <<-EOSQL
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
EOSQL