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
|
|
|
|
|
|
|
|
metadata = MetaData()
|
|
|
|
|
|
|
|
Ancestry = Table(
|
|
|
|
"ancestry",
|
|
|
|
metadata,
|
2024-01-28 14:31:50 -08:00
|
|
|
Column("name", String, primary_key=True),
|
2024-01-28 00:46:19 -08:00
|
|
|
Column("slug", String, index=True, unique=True),
|
|
|
|
Column("description", UnicodeText),
|
|
|
|
)
|
|
|
|
|
|
|
|
Character = Table(
|
|
|
|
"character",
|
|
|
|
metadata,
|
|
|
|
Column("id", Integer, primary_key=True, autoincrement=True),
|
|
|
|
Column("slug", String, index=True, unique=True),
|
2024-01-28 14:31:50 -08:00
|
|
|
Column("ancestry_name", Integer, ForeignKey("ancestry.name")),
|
2024-01-28 00:46:19 -08:00
|
|
|
Column("name", String),
|
2024-01-28 14:31:50 -08:00
|
|
|
Column("level", Integer, CheckConstraint('level > 0 AND level <= 20')),
|
|
|
|
Column("str", Integer, CheckConstraint('str >=0')),
|
|
|
|
Column("dex", Integer, CheckConstraint('dex >=0')),
|
|
|
|
Column("con", Integer, CheckConstraint('con >=0')),
|
|
|
|
Column("int", Integer, CheckConstraint('int >=0')),
|
|
|
|
Column("wis", Integer, CheckConstraint('wis >=0')),
|
|
|
|
Column("cha", Integer, CheckConstraint('cha >=0')),
|
2024-01-28 00:46:19 -08:00
|
|
|
)
|