Gate_B24YAT/models/models.py

24 lines
665 B
Python
Raw Normal View History

from datetime import datetime
from sqlalchemy import MetaData, Table, Column, Integer, String, TIMESTAMP, ForeignKey, JSON
metadata = MetaData()
roles = Table(
"roles",
metadata,
Column("id", Integer, primary_key=True),
Column("name", String, nullable=False),
Column("permissions", JSON),
)
users = Table(
"users",
metadata,
Column("id", Integer, primary_key=True),
Column("email", String, nullable=False),
Column("username", String, nullable=False),
Column("password", String, nullable=False),
Column("registered_at", TIMESTAMP, default=datetime.utcnow),
Column("role_id", Integer, ForeignKey("roles.id")),
)