Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sfr-2054_PubSourceFieldMigration #306

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

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.ARRAY(sa.Unicode), index=True))
op.add_column('items', sa.Column('publisher_project_source', sa.ARRAY(sa.Unicode), index=True))
mitri-slory marked this conversation as resolved.
Show resolved Hide resolved


def downgrade():
op.drop_column('records', 'publisher_project_source')
op.drop_column('items', 'publisher_project_source')
mitri-slory marked this conversation as resolved.
Show resolved Hide resolved
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(ARRAY(Unicode, dimensions=1), 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(ARRAY(Unicode, dimensions=1), 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
Loading