Skip to content

Commit

Permalink
model: add model WorkflowRecordSource
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Cesarano <[email protected]>
SIgned-off-by: Samuele Kaplun <[email protected]>

This model will be used to store records before they are modified by curators.
This will allow to merge records using the three-way-merging strategy
implemented by `inspire-json-merger`.
  • Loading branch information
ammirate committed Nov 22, 2017
1 parent 04fdcfc commit f04c1a4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions inspirehep/modules/workflows/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

from datetime import datetime

from sqlalchemy.dialects import postgresql
from sqlalchemy_utils.types import JSONType, UUIDType

from invenio_db import db


Expand Down Expand Up @@ -76,3 +79,24 @@ class WorkflowsPendingRecord(db.Model):
nullable=False,
)
record_id = db.Column(db.Integer, nullable=False)


class WorkflowsRecordSources(db.Model):

__tablename__ = "workflows_record_sources"
__table_args__ = (
db.PrimaryKeyConstraint('record_id', 'source'),
)
source = db.Column(db.Text, default="", nullable=False)
record_id = db.Column(
UUIDType,
db.ForeignKey("records_metadata.id", ondelete='CASCADE'),
nullable=False,
)
json = db.Column(
JSONType().with_variant(
postgresql.JSON(none_as_null=True),
'postgresql',
),
default=lambda: dict(),
)

0 comments on commit f04c1a4

Please sign in to comment.