Replace database methods with peewee ORM #39
1 changed files with 6 additions and 6 deletions
|
@ -13,15 +13,15 @@ from src.misc import clean
|
||||||
|
|
||||||
|
|
||||||
class Channel(Model):
|
class Channel(Model):
|
||||||
claim_id = TextField(column_name='ClaimId', primary_key=True)
|
claim_id = CharField(column_name='ClaimId', primary_key=True, max_length=40)
|
||||||
name = TextField(column_name='Name')
|
name = CharField(column_name='Name', max_length=256)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
table_name = 'CHANNEL'
|
table_name = 'CHANNEL'
|
||||||
|
|
||||||
|
|
||||||
class Comment(Model):
|
class Comment(Model):
|
||||||
comment = TextField(column_name='Body')
|
comment = CharField(column_name='Body', max_length=2000)
|
||||||
channel = ForeignKeyField(
|
channel = ForeignKeyField(
|
||||||
backref='comments',
|
backref='comments',
|
||||||
column_name='ChannelId',
|
column_name='ChannelId',
|
||||||
|
@ -29,9 +29,9 @@ class Comment(Model):
|
||||||
model=Channel,
|
model=Channel,
|
||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
comment_id = TextField(column_name='CommentId', primary_key=True)
|
comment_id = CharField(column_name='CommentId', primary_key=True, max_length=64)
|
||||||
is_hidden = BooleanField(column_name='IsHidden', constraints=[SQL("DEFAULT 0")])
|
is_hidden = BooleanField(column_name='IsHidden', constraints=[SQL("DEFAULT 0")])
|
||||||
claim_id = TextField(column_name='LbryClaimId')
|
claim_id = CharField(max_length=40, column_name='LbryClaimId')
|
||||||
parent = ForeignKeyField(
|
parent = ForeignKeyField(
|
||||||
column_name='ParentId',
|
column_name='ParentId',
|
||||||
field='comment_id',
|
field='comment_id',
|
||||||
|
@ -39,7 +39,7 @@ class Comment(Model):
|
||||||
null=True,
|
null=True,
|
||||||
backref='replies'
|
backref='replies'
|
||||||
)
|
)
|
||||||
signature = TextField(column_name='Signature', null=True, unique=True)
|
signature = CharField(max_length=128, column_name='Signature', null=True, unique=True)
|
||||||
signing_ts = TextField(column_name='SigningTs', null=True)
|
signing_ts = TextField(column_name='SigningTs', null=True)
|
||||||
timestamp = IntegerField(column_name='Timestamp')
|
timestamp = IntegerField(column_name='Timestamp')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue