from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class MatrixUser(db.Model): id = db.Column(db.Integer, primary_key=True) matrix_id = db.Column(db.Text, unique=True) room_id = db.Column(db.Text) pnut_id = db.Column(db.Text, unique=True) pnut_token = db.Column(db.Text) def __init__(self, matrix_id, room_id, pnut_id, pnut_token): self.matrix_id = matrix_id self.room_id = room_id self.pnut_id = pnut_id self.pnut_token = pnut_token def __repr__(self): return '' % self.matrix_id class MatrixRoom(db.Model): id = db.Column(db.Integer, primary_key=True) room_id = db.Column(db.Text, unique=True) pnut_chan = db.Column(db.Text) pnut_since = db.Column(db.Text) pnut_write = db.Column(db.Boolean, default=True) def __init__(self, room_id, pnut_chan, pnut_write=True): self.room_id = room_id self.pnut_chan = pnut_chan self.pnut_write = pnut_write def __repr__(self): return '' % self.room_id class MatrixRoom2(db.Model): id = db.Column(db.Integer, primary_key=True) room_id = db.Column(db.Text, unique=True) pnut_chan = db.Column(db.Text, unique=True) pnut_since = db.Column(db.Text) pnut_write = db.Column(db.Boolean, default=True) def __init__(self, room_id, pnut_chan, pnut_write=True): self.room_id = room_id self.pnut_chan = pnut_chan self.pnut_write = pnut_write def __repr__(self): return '' % self.room_id class MatrixMsgEvents(db.Model): id = db.Column(db.Integer, primary_key=True) event_id = db.Column(db.Text) room_id = db.Column(db.Text) pnut_msgid = db.Column(db.Text) pnut_user = db.Column(db.Text) pnut_chan = db.Column(db.Text) deleted = db.Column(db.Boolean, default=False) def __init__(self, event_id, room_id, pnut_msgid, pnut_user, pnut_chan): self.event_id = event_id self.room_id = room_id self.pnut_msgid = pnut_msgid self.pnut_user = pnut_user self.pnut_chan = pnut_chan class MatrixAdminRooms(db.Model): id = db.Column(db.Integer, primary_key=True) matrix_id = db.Column(db.Text) room_id = db.Column(db.Text) def __init__(self, matrix_id, room_id): self.matrix_id = matrix_id self.room_id = room_id