2020-02-21 19:32:24 +00:00
|
|
|
from sqlalchemy import *
|
|
|
|
from sqlalchemy.orm import *
|
|
|
|
from sqlalchemy.ext.declarative import *
|
|
|
|
|
|
|
|
|
|
|
|
class DndActiveBattle:
|
|
|
|
__tablename__ = "dndactivebattle"
|
|
|
|
|
2020-03-04 00:00:55 +00:00
|
|
|
@declared_attr
|
|
|
|
def active_battle_id(self):
|
|
|
|
return Column(Integer, primary_key=True)
|
|
|
|
|
2020-02-21 19:32:24 +00:00
|
|
|
@declared_attr
|
|
|
|
def battle_id(self):
|
2020-03-04 00:00:55 +00:00
|
|
|
return Column(Integer, ForeignKey("dndbattle.id"))
|
2020-02-21 19:32:24 +00:00
|
|
|
|
|
|
|
@declared_attr
|
|
|
|
def battle(self):
|
2020-02-22 01:16:54 +00:00
|
|
|
return relationship("DndBattle", foreign_keys=self.battle_id, backref=backref("activated_in"))
|
2020-02-21 19:32:24 +00:00
|
|
|
|
|
|
|
@declared_attr
|
|
|
|
def interface_name(self):
|
|
|
|
return Column(String)
|
|
|
|
|
|
|
|
@declared_attr
|
|
|
|
def interface_data(self):
|
|
|
|
return Column(LargeBinary)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return f"<{self.__class__.__qualname__}: {self.battle_id}>"
|