added matrix room model

This commit is contained in:
Morgan McMillian 2017-03-04 12:54:43 -08:00
parent afaf91c6cc
commit d59e74919f
2 changed files with 52 additions and 1 deletions

View file

@ -0,0 +1,36 @@
"""empty message
Revision ID: d2033352cfdf
Revises: b6667aa4e705
Create Date: 2017-03-04 12:52:51.625451
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd2033352cfdf'
down_revision = 'b6667aa4e705'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('matrix_room',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('room_id', sa.Text(), nullable=True),
sa.Column('pnut_chan', sa.Text(), nullable=True),
sa.Column('pnut_since', sa.Text(), nullable=True),
sa.Column('pnut_write', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('room_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('matrix_room')
# ### end Alembic commands ###

View file

@ -16,4 +16,19 @@ class MatrixUser(db.Model):
self.pnut_token = pnut_token self.pnut_token = pnut_token
def __repr__(self): def __repr__(self):
return '<MatrixUser %r' % self.matrix_id return '<MatrixUser %r>' % 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 '<MatrixRoom %r>' % self.room_id