Skip to content

Bow before the ORM! #86

@nphilipp

Description

@nphilipp

Story Time

As a contributor to mirrors-countme,
I would like that I can use its databases easier and that their structures are well-defined,
so that I’m less likely to make mistakes.

As a contributor to or operator of mirrors-countme,
I would like to have a well-defined way to manage changes in the database structure,
so I don’t lose sleep over this when it happens.

Acceptance Criteria

  • The ad-hoc created databases are inspected and SQLAlchemy declarative models are created from this.
  • The code uses these model classes to operate on the databases rather than hand-written SQL.
  • The Alembic framework is used to manage changes in database schemas.

Background

Right now, database accesses are all hand-written SQL (all across the code), partly inspecting table structure in one place, partly creating indexes on the spot in another, so that it’s easiest to just run the tools and see how tables look like. A defined model would make this much more manageable and approachable.

Also, we just so skirted the need to change the DB structure which would have gotten really hairy. 😬

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributingImprovements to contributingmaintenanceSomething outside of a full-scale projectsimplificationSimplifying code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions