feat(db): set up Alembic migrations with full initial schema#64
Conversation
- Complete alembic.ini with logging config - alembic/env.py: async engine, imports all 20 models for autogenerate, reads DATABASE_URL from environment at runtime - alembic/script.py.mako: migration file template - e5c18ff2255d_initial_schema.py: captures full current schema (20 tables) users, themes, projects, journal_entries, journal_templates, journal_media, export_jobs, export_files, export_history, export_queue, export_templates, kdp_submissions, agent_runs, email_verifications, password_resets, refresh_tokens, oauth_accounts, login_attempts, security_events, inventory_team_activity, inventory_generation_context, inventory_quick_actions Existing DB stamped at head — no destructive changes to running instance. Future schema changes: alembic revision --autogenerate -m "description" Apply migrations: alembic upgrade head Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||||||
User description
Summary
alembic/env.py: async engine, imports all 20 models, readsDATABASE_URLfrom envalembic/script.py.mako: migration templatee5c18ff2255d_initial_schema.py: initial migration capturing all 20 tableshead— no destructive changesUsage going forward
🤖 Generated with Claude Code
PR Type
Enhancement
Description
Complete Alembic setup with async engine and environment configuration
Initial migration capturing 20 database tables with full schema
Database URL read from environment variable at runtime
Migration template and logging configuration for future schema changes
Diagram Walkthrough
File Walkthrough
env.py
Async engine setup with model importsjournal-platform-backend/alembic/env.py
async_engine_from_configDATABASE_URLenvironment variable at runtime for databaseconnection
e5c18ff2255d_initial_schema.py
Initial schema migration for 20 tablesjournal-platform-backend/alembic/versions/e5c18ff2255d_initial_schema.py
journal_templates, journal_media, export_jobs, export_files,
export_history, export_queue, export_templates, kdp_submissions,
agent_runs, email_verifications, password_resets, refresh_tokens,
oauth_accounts, login_attempts, security_events,
inventory_team_activity, inventory_generation_context,
inventory_quick_actions
script.py.mako
Migration file template structurejournal-platform-backend/alembic/script.py.mako
alembic.ini
Logging and database configurationjournal-platform-backend/alembic.ini