paper-dynasty-gameplay-webapp/scripts/README.md
Cal Corum c09f9d1302 CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture
Establishes foundation for migrating baseball simulation from Discord bot to web application using service-oriented architecture pattern.

Key components:
- FastAPI application structure with dependency injection
- Service layer foundation with base classes and container
- Comprehensive directory documentation with README files
- PostgreSQL containerization with Docker Compose
- Testing structure for unit/integration/e2e tests
- Migration planning documentation
- Rotating log configuration per user requirements

Architecture follows Model/Service/Controller pattern to improve testability, maintainability, and scalability over original monolithic Discord app.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 21:44:12 -05:00

46 lines
1.5 KiB
Markdown

# Scripts Directory
This directory contains database initialization scripts and other utility scripts for the Paper Dynasty web app.
## Files
### `init-db.sql`
PostgreSQL initialization script that runs when the Docker container is first created:
- **Creates test database**: `paper_dynasty_test` for integration testing
- **Grants permissions**: Ensures `paper_dynasty_user` has access to both databases
- **Runs automatically**: Executed by Docker Compose on first container startup
## Database Setup
The `init-db.sql` script is automatically executed when the PostgreSQL container starts for the first time via Docker's `docker-entrypoint-initdb.d` mechanism.
### What it creates:
```sql
-- Main development database (created by POSTGRES_DB env var)
-- paper_dynasty
-- Test database for integration tests
CREATE DATABASE paper_dynasty_test;
-- User permissions
GRANT ALL PRIVILEGES ON DATABASE paper_dynasty TO paper_dynasty_user;
GRANT ALL PRIVILEGES ON DATABASE paper_dynasty_test TO paper_dynasty_user;
```
### Container Integration
The script is mounted into the PostgreSQL container via `docker-compose.yml`:
```yaml
volumes:
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
```
## Future Scripts
This directory can be extended with additional utility scripts:
- **Migration scripts**: Database schema migrations
- **Data seeding**: Sample data for development
- **Backup scripts**: Database backup utilities
- **Development helpers**: Setup and maintenance scripts