2024-01-28 00:46:19 -08:00
|
|
|
from sqlalchemy import MetaData
|
|
|
|
from sqlalchemy import Table
|
|
|
|
from sqlalchemy import Column
|
|
|
|
from sqlalchemy import Integer
|
|
|
|
from sqlalchemy import String
|
|
|
|
from sqlalchemy import UnicodeText
|
|
|
|
from sqlalchemy import ForeignKey
|
2024-01-28 14:31:50 -08:00
|
|
|
from sqlalchemy import CheckConstraint
|
2024-01-28 00:46:19 -08:00
|
|
|
# from sqlalchemy import PrimaryKeyConstraint
|
|
|
|
# from sqlalchemy import DateTime
|
|
|
|
|
2024-01-30 01:25:02 -08:00
|
|
|
from pyramid_sqlalchemy import BaseObject
|
2024-01-28 00:46:19 -08:00
|
|
|
|
2024-01-30 01:25:02 -08:00
|
|
|
class Ancestry(BaseObject):
|
|
|
|
__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)
|
|
|
|
slug = Column(String, index=True, unique=True)
|
|
|
|
|
|
|
|
|
|
|
|
class Character(BaseObject):
|
|
|
|
__tablename__ = "character"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
slug = Column(String, index=True, unique=True)
|
|
|
|
ancestry = Column(String, ForeignKey("ancestry.name"))
|
|
|
|
name = Column(String)
|
|
|
|
level = Column(Integer, CheckConstraint('level > 0 AND level <= 20'))
|
|
|
|
str = Column(Integer, CheckConstraint('str >=0'))
|
|
|
|
dex = Column(Integer, CheckConstraint('dex >=0'))
|
|
|
|
con = Column(Integer, CheckConstraint('con >=0'))
|
|
|
|
int = Column(Integer, CheckConstraint('int >=0'))
|
|
|
|
wis = Column(Integer, CheckConstraint('wis >=0'))
|
|
|
|
cha = Column(Integer, CheckConstraint('cha >=0'))
|