Skip to content

Commit

Permalink
Merge pull request #44 from spacemansteve/master
Browse files Browse the repository at this point in the history
forgot alembic file for data links
  • Loading branch information
seasidesparrow committed Feb 26, 2018
2 parents 7ef45c4 + 393ac4b commit bcf323e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ ENV/

# mypy
.mypy_cache/

# emacs
*~
40 changes: 40 additions & 0 deletions alembic/versions/991505386bc9_added_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""added links
Revision ID: 991505386bc9
Revises: 104f440cf5d5
Create Date: 2018-02-14 09:42:29.869790
"""

# revision identifiers, used by Alembic.
revision = '991505386bc9'
down_revision = '104f440cf5d5'

from alembic import op
import sqlalchemy as sa


# datalinks info is in nonbib data
# it is not stored as a separate column
# we just need to a column for the timestamp
# of when links data was processed (sent to persistent store)

def upgrade():
# sqlite doesn't have ALTER command
cx = op.get_context()
if 'sqlite' in cx.connection.engine.name:
with op.batch_alter_table("records") as batch_op:
batch_op.add_column(sa.Column('datalinks_processed', sa.TIMESTAMP))

else:
op.add_column('records', sa.Column('datalinks_processed', sa.TIMESTAMP))


def downgrade():
cx = op.get_context()
if 'sqlite' in cx.connection.engine.name:
with op.batch_alter_table("records") as batch_op:
batch_op.drop_column('datalinks_processed')
else:
op.drop_column('records', 'datalinks_processed')

0 comments on commit bcf323e

Please sign in to comment.