Fix enum schema (#715)

* fix schema with enum fields - issue #699

* fix drivers dependencies - make them optional

* fix command

* provide extras

* add bolean field to related model

* add test with select related and boolean

* new test case based on issue

* fix bool issue in postgres limit queries - issue #704

* fix coverage

* bump version and add release info
This commit is contained in:
collerek
2022-06-26 19:36:13 +02:00
committed by GitHub
parent 9b6fa2e8ac
commit 6af92aa893
10 changed files with 280 additions and 108 deletions

View File

@ -34,6 +34,7 @@ class Track(ormar.Model):
title: str = ormar.String(max_length=100)
position: int = ormar.Integer()
play_count: int = ormar.Integer(nullable=True, default=0)
is_disabled: bool = ormar.Boolean(default=False)
class Cover(ormar.Model):
@ -350,6 +351,18 @@ async def test_limit_and_offset():
assert len(tracks) == 1
assert tracks[0].title == "Sample2"
album = await Album.objects.select_related("tracks").limit(1).get()
assert len(album.tracks) == 3
assert album.tracks[0].title == "Sample"
album = (
await Album.objects.select_related("tracks")
.limit(1, limit_raw_sql=True)
.get()
)
assert len(album.tracks) == 1
assert album.tracks[0].title == "Sample"
@pytest.mark.asyncio
async def test_get_exceptions():