summaryrefslogtreecommitdiff
path: root/archivist/model.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2017-03-11 15:41:10 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2017-03-11 15:41:10 +0100
commit3392f9ab0a0e2c2a5f2bf2db79973ea9a5110593 (patch)
treee0b69c6547bdbf883132bdb3f4f79cd15d120a93 /archivist/model.py
parenteb290e7ae4a1f4707d62e43d05f70d76e7ca5fb2 (diff)
downloadarchivist-3392f9ab0a0e2c2a5f2bf2db79973ea9a5110593.tar.gz
archivist-3392f9ab0a0e2c2a5f2bf2db79973ea9a5110593.tar.bz2
archivist-3392f9ab0a0e2c2a5f2bf2db79973ea9a5110593.zip
Upgrade to peewee-2.9 and drop our customizations
Diffstat (limited to '')
-rw-r--r--archivist/model.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/archivist/model.py b/archivist/model.py
index b76783e..e672d29 100644
--- a/archivist/model.py
+++ b/archivist/model.py
@@ -1,14 +1,14 @@
from peewee import *
from playhouse.fields import CompressedField as _CompressedField
from playhouse.hybrid import *
-from playhouse.sqlite_ext import SqliteExtDatabase
+from playhouse.sqlite_ext import SqliteExtDatabase, ClosureTable
import datetime
from enum import Enum, unique
from pkg_resources import resource_filename
from .prefixes import query_pseudo_prefix
-from .peewee_ext import ClosureTable, EnumField
+from .peewee_ext import EnumField
db = SqliteExtDatabase('test.db', pragmas=[('foreign_keys', 'ON')])
db.load_extension(resource_filename(__name__, 'sqlext/closure'))
@@ -162,5 +162,8 @@ class TagImplications(BaseModel):
def __repr__(self):
return "<%s %d --> %d>" % (self.__class__.__name__, self.tag_id, self.implies_tag_id)
-TagClosure = ClosureTable(Tag, TagImplications, TagImplications.implies_tag, TagImplications.tag)
-table(TagClosure)
+TagClosure = table(ClosureTable(
+ Tag,
+ referencing_class = TagImplications,
+ foreign_key = TagImplications.implies_tag,
+ referencing_key = TagImplications.tag))