Skip to content

Commit

Permalink
Fix ORM model and add alembic check (#60)
Browse files Browse the repository at this point in the history
* Correct Artefact ORM model to match migrations

* Add CI check to catch if alembic detects migrations

* Try a fix to alembic action

* Try a fix to alembic action

* Try a fix to alembic action

* Bring back rest of backend test CI

* Bug fix
  • Loading branch information
omar-selo committed Nov 3, 2023
1 parent 3358d9c commit d7485c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ jobs:
- run: poetry run pytest
env:
TEST_DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres
- run: poetry run alembic upgrade head
env:
DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres
- name: Check if alembic migrations are up to date
run: poetry run alembic check
env:
DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres
5 changes: 2 additions & 3 deletions backend/test_observer/data_access/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ class Artefact(Base):
status: Mapped[ArtefactStatus | None]

__table_args__ = (
UniqueConstraint(
"name", "version", "track", "series", "repo", name="unique_artefact"
),
UniqueConstraint("name", "version", "track", name="unique_snap"),
UniqueConstraint("name", "version", "series", "repo", name="unique_deb"),
)

def __repr__(self) -> str:
Expand Down

0 comments on commit d7485c0

Please sign in to comment.