mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Init
This commit is contained in:
21
src/app/models.py
Normal file
21
src/app/models.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import ormar
|
||||
|
||||
from core.db import metadata, database
|
||||
|
||||
|
||||
class BaseMeta(ormar.ModelMeta):
|
||||
metadata = metadata
|
||||
database = database
|
||||
|
||||
|
||||
class CachedFile(ormar.Model):
|
||||
class Meta(BaseMeta):
|
||||
tablename = "cached_files"
|
||||
constraints = [
|
||||
ormar.UniqueColumns('object_id','object_type')
|
||||
]
|
||||
|
||||
id: int = ormar.Integer(primary_key=True) # type: ignore
|
||||
object_id: int = ormar.Integer() # type: ignore
|
||||
object_type: str = ormar.String(max_length=8) # type: ignore
|
||||
data = ormar.JSON()
|
||||
Reference in New Issue
Block a user