Skip to content

Fix/issue 2341 alembic migrations#2347

Merged
janavipandole merged 4 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2341-alembic-migrations
Jun 20, 2026
Merged

Fix/issue 2341 alembic migrations#2347
janavipandole merged 4 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2341-alembic-migrations

Conversation

@Prateek2007-cmd

Copy link
Copy Markdown
Contributor

Description

Resolves Issue #2341 (Direct Schema Creation over Migrations).

The backend previously relied on SQLAlchemy's metadata.create_all() at startup. This "development-only" approach is a severe architectural liability in production, as it cannot gracefully handle schema evolutions (like adding or dropping columns) without dropping the entire database, risking catastrophic data loss.

This PR introduces Alembic to manage database schemas via deterministic, version-controlled migration scripts.

Changes Made

  • Removed Dangerous Auto-Creation: Purged create_all() from backend/app/main.py.
  • Alembic Pipeline: Initialized the alembic environment, pointing alembic.ini to the SQLite cara.db.
  • Target Metadata: Configured alembic/env.py to securely read from backend.app.models.Base.metadata to support --autogenerate.
  • Initial Revision: Generated the first automated migration script encompassing all existing models.

Type of Change

  • Architectural Improvement
  • Technical Debt Remediation

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@Prateek2007-cmd is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

@janavipandole janavipandole merged commit 331113f into janavipandole:main Jun 20, 2026
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants