Skip to content

Commit

Permalink
Merge pull request #306 from NYPL/SFR-2054_PubProjectSourceFieldMigra…
Browse files Browse the repository at this point in the history
…tion

Sfr-2054_PubSourceFieldMigration
  • Loading branch information
mitri-slory authored Jul 19, 2024
2 parents 22e0e43 + 6b90653 commit 76e2544
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- New process to add fulfill urls to Limited Access manifests and update fulfill_limited_access flags to True
- Updated README and added more information to installation steps
- Deprecated datetime.utcnow() method
- Added new field (publisher_project_source) to the records and item tables
## Fixed
- Resolved the format of fulfill endpoints in UofM manifests
- Added additional logging to the editions endpoint to debug
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""add publisher_project_source field to records and items
Revision ID: 54e57fb2e1c6
Revises: e46b30dd3ff5
Create Date: 2024-06-26 15:04:24.092549
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '54e57fb2e1c6'
down_revision = 'e46b30dd3ff5'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('records', sa.Column('publisher_project_source', sa.Unicode, index=True))
op.add_column('items', sa.Column('publisher_project_source', sa.Unicode, index=True))


def downgrade():
op.drop_column('records', 'publisher_project_source')
op.drop_column('items', 'publisher_project_source')
3 changes: 2 additions & 1 deletion model/postgres/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Item(Base, Core):

id = Column(Integer, primary_key=True)
source = Column(Unicode, nullable=False, index=True)
publisher_project_source = Column(Unicode, index=True)
content_type = Column(Unicode)
contributors = Column(JSONB)
modified = Column(DateTime)
Expand All @@ -44,6 +45,6 @@ def __repr__(self):

def __dir__(self):
return [
'source', 'content_type', 'contributors', 'modified', 'drm',
'source', 'publisher_project_source', 'content_type', 'contributors', 'modified', 'drm',
'measurements'
]
3 changes: 2 additions & 1 deletion model/postgres/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Record(Base, Core):
)
cluster_status = Column(Boolean, default=False, nullable=False, index=True)
source = Column(Unicode, index=True) # dc:source, Non-Repeating
publisher_project_source = Column(Unicode, index=True) # dc:publisherProjectSource, Non-Repeating
source_id = Column(Unicode, index=True) # dc:identifier, Non-Repeating
title = Column(Unicode) # dc:title, Non-Repeating
alternative = Column(ARRAY(Unicode, dimensions=1)) # dc:alternative, Repeating
Expand Down Expand Up @@ -49,7 +50,7 @@ def __repr__(self):
)

def __dir__(self):
return ['uuid', 'frbr_status', 'cluster_status', 'source', 'source_id',
return ['uuid', 'frbr_status', 'cluster_status', 'source', 'publisher_project_source', 'source_id',
'title', 'alternative', 'medium', 'is_part_of', 'subjects', 'authors',
'contributors', 'languages', 'dates', 'rights', 'identifiers',
'date_submitted', 'requires', 'spatial', 'publisher', 'has_version',
Expand Down

0 comments on commit 76e2544

Please sign in to comment.