Add 'active' column to newsgroup

This commit is contained in:
XANTRONIX Development 2024-12-02 15:09:32 -05:00
parent 1346ece242
commit 888d25394a
2 changed files with 9 additions and 3 deletions

View file

@ -5,7 +5,8 @@ create table newsgroup (
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by TEXT NOT NULL, created_by TEXT NOT NULL,
name TEXT NOT NULL, name TEXT NOT NULL,
description TEXT NOT NULL description TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT FALSE
); );
create table message ( create table message (

View file

@ -5,7 +5,10 @@ from nntp.tiny.db import DatabaseTable
class Newsgroup(DatabaseTable): class Newsgroup(DatabaseTable):
name = 'newsgroup' name = 'newsgroup'
key = 'id' key = 'id'
columns = 'id', 'created_on', 'created_by', 'name', 'description', columns = (
'id', 'created_on', 'created_by', 'name', 'description',
'active'
)
@staticmethod @staticmethod
def __from_row__(row): def __from_row__(row):
@ -15,6 +18,7 @@ class Newsgroup(DatabaseTable):
newsgroup.created_by = row['created_by'] newsgroup.created_by = row['created_by']
newsgroup.name = row['name'] newsgroup.name = row['name']
newsgroup.description = row['description'] newsgroup.description = row['description']
newsgroup.active = row['active']
return newsgroup return newsgroup
@ -23,5 +27,6 @@ class Newsgroup(DatabaseTable):
self.created_on.isoformat(), self.created_on.isoformat(),
self.created_by, self.created_by,
self.name, self.name,
self.description self.description,
self.active
) )