summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-04-13 16:21:28 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-04-13 16:21:28 -0700
commit13f7b0f5ff574171ae2a35b48d637d57906871cd (patch)
treeee42fe0389f7be93be7ed04cb30dc2ef09eff3e2
parentbd6f8f46e2ac52352b8077f1de8c382a303ce45c (diff)
downloadfatcat-13f7b0f5ff574171ae2a35b48d637d57906871cd.tar.gz
fatcat-13f7b0f5ff574171ae2a35b48d637d57906871cd.zip
remove rev -> edit fc
-rw-r--r--fatcat/models.py30
-rw-r--r--fatcat/sql.py3
-rw-r--r--tests/test_backend.py2
3 files changed, 9 insertions, 26 deletions
diff --git a/fatcat/models.py b/fatcat/models.py
index 975a5bb7..210d71a6 100644
--- a/fatcat/models.py
+++ b/fatcat/models.py
@@ -64,7 +64,6 @@ class FileRelease(db.Model):
class WorkRev(db.Model):
__tablename__ = 'work_rev'
id = db.Column(db.Integer, primary_key=True)
- edit_id = db.Column(db.ForeignKey('work_edit.id'))
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
title = db.Column(db.String)
@@ -95,14 +94,15 @@ class WorkEdit(db.Model):
ident_id = db.Column(db.ForeignKey('work_ident.id'), nullable=True)
rev_id = db.Column(db.ForeignKey('work_rev.id'), nullable=True)
redirect_id = db.Column(db.ForeignKey('work_ident.id'), nullable=True)
- edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
+ edit_group_id = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
+ rev = db.relationship("WorkRev")
+ edit_group = db.relationship("EditGroup")
class ReleaseRev(db.Model):
__tablename__ = 'release_rev'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
- edit_id = db.Column(db.ForeignKey('release_edit.id'))
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
work_ident_id = db.ForeignKey('work_ident.id')
@@ -135,14 +135,13 @@ class ReleaseEdit(db.Model):
ident_id = db.Column(db.ForeignKey('release_ident.id'), nullable=True)
rev_id = db.Column(db.ForeignKey('release_rev.id'), nullable=True)
redirect_id = db.Column(db.ForeignKey('release_ident.id'), nullable=True)
- edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
+ edit_group_id = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
class CreatorRev(db.Model):
__tablename__ = 'creator_rev'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
- edit_id = db.Column(db.ForeignKey('creator_edit.id'))
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
name = db.Column(db.String)
@@ -163,14 +162,13 @@ class CreatorEdit(db.Model):
ident_id = db.Column(db.ForeignKey('creator_ident.id'), nullable=True)
rev_id = db.Column(db.ForeignKey('creator_rev.id'), nullable=True)
redirect_id = db.Column(db.ForeignKey('creator_ident.id'), nullable=True)
- edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
+ edit_group_id = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
class ContainerRev(db.Model):
__tablename__ = 'container_rev'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
- edit_id = db.Column(db.ForeignKey('container_edit.id'))
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
name = db.Column(db.String)
@@ -193,14 +191,13 @@ class ContainerEdit(db.Model):
ident_id = db.Column(db.ForeignKey('container_ident.id'), nullable=True)
rev_id = db.Column(db.ForeignKey('container_rev.id'), nullable=True)
redirect_id = db.Column(db.ForeignKey('container_ident.id'), nullable=True)
- edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
+ edit_group_id = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
class FileRev(db.Model):
__tablename__ = 'file_rev'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
- edit_id = db.Column(db.ForeignKey('file_edit.id'))
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
size = db.Column(db.Integer)
@@ -222,25 +219,12 @@ class FileEdit(db.Model):
ident_id = db.Column(db.ForeignKey('file_ident.id'), nullable=True)
rev_id = db.Column(db.ForeignKey('file_rev.id'), nullable=True)
redirect_id = db.Column(db.ForeignKey('file_ident.id'), nullable=True)
- edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
+ edit_group_id = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
### Editing #################################################################
-#class Edit(db.Model):
-# __tablename__ = 'edit'
-# id = db.Column(db.Integer, primary_key=True, autoincrement=True)
-# edit_group = db.Column(db.ForeignKey('edit_group.id'), nullable=True)
-# editor = db.Column(db.ForeignKey('editor.id'), nullable=False)
-# comment = db.Column(db.String, nullable=True)
-# extra_json = db.Column(db.ForeignKey('extra_json.sha1'), nullable=True)
-# # WARNING: polymorphic. Represents the ident that should end up pointing to
-# # this revision.
-# entity_ident = db.Column(db.Integer, nullable=True)
-# entity_rev = db.Column(db.Integer, nullable=True)
-# entity_redirect = db.Column(db.Integer, nullable=True)
-
class EditGroup(db.Model):
__tablename__ = 'edit_group'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
diff --git a/fatcat/sql.py b/fatcat/sql.py
index 782f7983..6ca56b46 100644
--- a/fatcat/sql.py
+++ b/fatcat/sql.py
@@ -228,7 +228,6 @@ def hydrate_work(wid):
hydro.update({
"work_type": work.revision.work_type,
"title": work.revision.title,
- "edit_id": work.revision.edit_id,
"primary": primary,
"creators": creators,
"releases": releases,
@@ -244,7 +243,7 @@ def hydrate_release(rid):
"_type": "release",
"id": rid,
"revision": release.rev_id,
- "edit_id": release.revision.edit_id,
+ #"edit_id": release.revision.edit_id,
"is_live": release.live,
"work_id": release.revision.work_ident_id,
diff --git a/tests/test_backend.py b/tests/test_backend.py
index bc610d25..93e3f11a 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -12,7 +12,7 @@ import tempfile
## Helpers ##################################################################
def check_entity_fields(e):
- for key in ('id', 'rev', 'redirect_id', 'edit_id'):
+ for key in ('id', 'rev', 'redirect_id'):
assert key in e
for key in ('id',):
assert e[key] is not None