Skip to content

feat: Implement Alembic for database migrations, including configuration, baseline schema, and Docker integration.#168

Merged
mekarpeles merged 5 commits into
ArchiveLabs:mainfrom
ronibhakta1:feature/#167/alembic
Mar 23, 2026
Merged

feat: Implement Alembic for database migrations, including configuration, baseline schema, and Docker integration.#168
mekarpeles merged 5 commits into
ArchiveLabs:mainfrom
ronibhakta1:feature/#167/alembic

Conversation

@ronibhakta1
Copy link
Copy Markdown
Collaborator

@ronibhakta1 ronibhakta1 commented Mar 10, 2026

Closes #167
This pull request introduces a comprehensive database migration system using Alembic, improves operational safety and developer experience with new Makefile commands, and updates the documentation and Docker setup to support these changes. The most significant updates are the addition of Alembic-based migrations (with an initial baseline), new Makefile targets for safe updates and migration management, and enhancements to developer tooling and documentation.

Database migrations and schema management:

  • Added Alembic migration engine, including configuration files (alembic.ini, alembic/env.py), a migration script template (alembic/script.py.mako), and the initial baseline migration (alembic/versions/001_baseline_schema.py) for items and loans tables. This enables versioned, automated schema changes and safe upgrades. [1] [2] [3] [4]
  • Updated the Docker API image to include Alembic and run migrations automatically on container startup, ensuring the database schema is always up-to-date. [1] [2]

Developer and operational tooling:

  • Expanded the Makefile with new commands for safe updates (make update), database migrations (make migrate, make migrate-status, make migration, make migrate-rollback, make migrate-stamp, make squash-migrations), and a health check utility (make doctor). Added warnings to destructive commands and introduced make redeploy for safe code updates without data loss. [1] [2] [3]
  • Added a doctor.sh script for comprehensive environment diagnostics, checking Docker, configuration, database, and disk space.

Documentation improvements:

  • Updated README.md with sections on updating, database migrations, health checks, and clarified rebuild/update workflows. Added documentation for Alembic and new Makefile commands. [1] [2] [3] [4] [5]

Configuration and environment:

  • Introduced a VERSION file to track the current release version, which is now copied into the Docker image. [1] [2]
  • Changed environment variable from LENNY_RELOAD to LENNY_PRODUCTION for clearer dev/production mode switching, and updated related scripts. [1] [2]

Reliability and health:

  • Added a healthcheck to the API service in compose.yaml to ensure the service is ready before dependent services start.

These changes lay the foundation for safe, automated upgrades, robust schema management, and improved developer experience.

…ion, baseline schema, and Docker integration.
@ronibhakta1 ronibhakta1 self-assigned this Mar 10, 2026
@ronibhakta1 ronibhakta1 marked this pull request as draft March 15, 2026 16:13
…e scripts, and comprehensive documentation for releases and environment health.
@ronibhakta1 ronibhakta1 marked this pull request as ready for review March 21, 2026 18:18
@@ -0,0 +1,23 @@
# Dev/Prod Mode via LENNY_PRODUCTION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably don't need these plans checked in

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was reusing the existing environment with different names to make things much clearer.

@mekarpeles mekarpeles merged commit e22eb73 into ArchiveLabs:main Mar 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alemblic support + Lenny CLI updater

2 participants