tabletop-frog/ttfrog/db/schema.py

31 lines
1.0 KiB
Python
Raw Normal View History

2024-01-28 00:46:19 -08:00
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import ForeignKey
# from sqlalchemy import PrimaryKeyConstraint
# from sqlalchemy import DateTime
2024-01-31 22:39:54 -08:00
from ttfrog.db.base import Bases
2024-01-28 00:46:19 -08:00
2024-01-31 22:39:54 -08:00
class Ancestry(*Bases):
2024-01-30 01:25:02 -08:00
__tablename__ = "ancestry"
2024-01-28 00:46:19 -08:00
2024-01-30 01:25:02 -08:00
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String, index=True, unique=True)
2024-01-31 22:39:54 -08:00
class Character(*Bases):
2024-01-30 01:25:02 -08:00
__tablename__ = "character"
id = Column(Integer, primary_key=True, autoincrement=True)
2024-01-31 22:39:54 -08:00
ancestry = Column(String, ForeignKey("ancestry.name"), nullable=False)
name = Column(String(255), nullable=False)
level = Column(Integer, nullable=False, info={'min': 1, 'max': 20})
2024-02-02 15:40:45 -08:00
str = Column(Integer, info={'min': 0, 'max': 30})
dex = Column(Integer, info={'min': 0, 'max': 30})
con = Column(Integer, info={'min': 0, 'max': 30})
int = Column(Integer, info={'min': 0, 'max': 30})
wis = Column(Integer, info={'min': 0, 'max': 30})
cha = Column(Integer, info={'min': 0, 'max': 30})