2022-09-17 18:12:14 +00:00
|
|
|
from base.orm import Base, engine
|
|
|
|
from orm.community import Community
|
|
|
|
from orm.notification import Notification
|
|
|
|
from orm.rbac import Operation, Resource, Permission, Role
|
|
|
|
from orm.reaction import Reaction
|
|
|
|
from orm.shout import Shout
|
|
|
|
from orm.topic import Topic, TopicFollower
|
|
|
|
from orm.user import User, UserRating
|
2022-11-19 11:35:34 +00:00
|
|
|
from orm.viewed import ViewedEntry
|
|
|
|
|
|
|
|
# NOTE: keep orm module isolated
|
2022-09-17 18:12:14 +00:00
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
"User",
|
|
|
|
"Role",
|
|
|
|
"Operation",
|
|
|
|
"Permission",
|
|
|
|
"Community",
|
|
|
|
"Shout",
|
|
|
|
"Topic",
|
|
|
|
"TopicFollower",
|
|
|
|
"Notification",
|
|
|
|
"Reaction",
|
2022-11-15 09:25:04 +00:00
|
|
|
"UserRating"
|
2022-11-19 11:35:34 +00:00
|
|
|
"ViewedEntry"
|
2022-09-17 18:12:14 +00:00
|
|
|
]
|
|
|
|
|
2022-09-19 13:50:43 +00:00
|
|
|
|
2022-11-19 11:35:34 +00:00
|
|
|
def init_tables():
|
|
|
|
Base.metadata.create_all(engine)
|
|
|
|
Operation.init_table()
|
|
|
|
Resource.init_table()
|
|
|
|
User.init_table()
|
|
|
|
Community.init_table()
|
|
|
|
UserRating.init_table()
|
|
|
|
Shout.init_table()
|
|
|
|
Role.init_table()
|
|
|
|
ViewedEntry.init_table()
|
|
|
|
print("[orm] tables initialized")
|