Skip to content

[ENHANCEMENT]: Introduce Database Migration System for Schema Management #406

Description

@Tushar15769

Current Behavior

The project currently manages database schema changes manually despite having multiple interconnected models such as User, ShelfItem, and ReadingStats. Any modification to the schema (e.g., adding fields, changing types, or relationships) requires direct database updates without version control.

This leads to:

High risk of data inconsistency or loss
Difficulties in maintaining parity between development and production environments
No rollback mechanism for failed schema changes
Increased chances of deployment errors

Suggested Improvement

Introduce a database migration system (e.g., Alembic or Flask-Migrate) to handle schema evolution in a structured and version-controlled manner.

The system should:

Track schema changes through migration scripts
Allow safe upgrades and downgrades of database versions
Integrate with the existing ORM models
Ensure consistent schema across all environments

This will replace manual schema updates with a reliable and automated workflow.

Benefits

Prevents data loss and schema inconsistencies
Enables safe and reversible database changes
Improves deployment reliability and team collaboration
Aligns the project with industry-standard practices

Possible Implementation

Integrate Flask-Migrate (Alembic) into the project
Initialize migration environment and configuration
Generate migration scripts from existing models
Apply migrations to synchronize database schema
Update deployment workflow to include migration steps

Activity

  1. Tushar15769 commented on May 3, 2026

    @Tushar15769
    ContributorAuthor

    Please assign this issue to me under NSoC'26
    Thanks!

  2. added
    enhancementNew feature or request
    NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source event
    on May 8, 2026
  3. Tushar15769 commented on May 10, 2026

    @Tushar15769
    ContributorAuthor

    I have resolved the issue and raised the PR so whenever you get time please review it and tell your views on the changes @devanshi14malhotra .
    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NSoC'26For issues and PRs which are a part of the Nexus Spring of Code open source eventbackenddbenhancementNew feature or requestlevel310 points

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions