This commit is contained in:
2024-12-11 16:16:49 +03:00
commit b2699db727
12 changed files with 481 additions and 0 deletions

14
models.py Normal file
View File

@@ -0,0 +1,14 @@
from sqlalchemy import Column, Integer, String, UniqueConstraint
from database import Base
class Counter(Base):
__tablename__ = "counters"
id = Column(Integer, primary_key=True, index=True)
namespace = Column(String, index=True, nullable=False)
application = Column(String, index=True, nullable=False)
version = Column(String, index=True, nullable=False)
value = Column(Integer, default=0, nullable=False)
__table_args__ = (
UniqueConstraint('namespace', 'application', 'version', name='_namespace_application_version_uc'),
)