Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/wiki/utils/orm.py

42 lines
1.3 KiB
Python
Raw Normal View History

2021-07-30 19:32:58 +00:00
from sqlalchemy import Column, String, Text, TIMESTAMP, text
from sqlalchemy.dialects.mysql import LONGTEXT
2021-07-28 18:51:24 +00:00
2022-06-13 04:49:22 +00:00
from database.orm import Session
from database.orm_base import Base
2021-07-28 18:51:24 +00:00
2021-07-30 19:32:58 +00:00
table_prefix = 'module_wiki_'
2022-06-13 04:49:22 +00:00
db = Session
2021-08-24 16:49:19 +00:00
session = db.session
engine = db.engine
2021-07-30 19:32:58 +00:00
class WikiTargetSetInfo(Base):
__tablename__ = table_prefix + 'TargetSetInfo'
targetId = Column(String(512), primary_key=True)
2021-08-24 12:44:26 +00:00
link = Column(LONGTEXT if session.bind.dialect.name == 'mysql' else Text)
iws = Column(LONGTEXT if session.bind.dialect.name == 'mysql' else Text)
headers = Column(LONGTEXT if session.bind.dialect.name == 'mysql' else Text)
2021-12-19 08:23:24 +00:00
prefix = Column(LONGTEXT if session.bind.dialect.name == 'mysql' else Text)
2021-07-30 19:32:58 +00:00
class WikiInfo(Base):
__tablename__ = table_prefix + 'WikiInfo'
apiLink = Column(String(512), primary_key=True)
siteInfo = Column(LONGTEXT if session.bind.dialect.name == 'mysql' else Text)
timestamp = Column(TIMESTAMP, default=text('CURRENT_TIMESTAMP'))
class WikiAllowList(Base):
__tablename__ = table_prefix + 'WikiAllowList'
2021-11-15 16:34:36 +00:00
apiLink = Column(String(512), primary_key=True)
2021-09-21 08:22:29 +00:00
operator = Column(String(512))
2021-07-30 19:32:58 +00:00
2021-11-17 13:17:13 +00:00
class WikiBlockList(Base):
__tablename__ = table_prefix + 'WikiBlockList'
apiLink = Column(String(512), primary_key=True)
operator = Column(String(512))
2022-06-13 04:49:22 +00:00
Session.create()