Skip to content

Add DB migration tool #58

Closed
Closed
@afred

Description

@afred

Because

As a Developer
I can use a migration tool to

### Tasks
- [x] create / set up Chowda db for tests
- [x] create / set up Chowda db for local development
- [x] use of `SQLModel.metadata.create_all(engine)` is removed

In order to

  • have a single tool for creating / setting up database in test, development, and production environments
  • have a production-ready tool for managing DB schema changes without data loss or wholesale DB reset operations
  • avoid concurrency issues in Github CI due to using SQLModel.metadata.create_all()
    ERROR tests/test_app.py - sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "pg_type_typname_nsp_index"
    DETAIL:  Key (typname, typnamespace)=(mediatype, 2200) already exists.
    

Done when

Users story is satisfied (check boxes)

Additional context

Most sources say that Alembic is the best tool for SQLAlchemy, and thus also SQLModel.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions