Skip to content

Commit

Permalink
db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
littleskunk committed Nov 4, 2015
1 parent e61b0d9 commit 2406a39
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dataserv/migrations/versions/1c91ee99cac_.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from alembic import op
import sqlalchemy as sa
from datetime import datetime, timedelta


def upgrade():
Expand All @@ -27,7 +28,10 @@ def upgrade():
op.create_index(op.f('ix_audit_block'), 'audit', ['block'], unique=False)
op.add_column('farmer', sa.Column('reg_time', sa.DateTime(), nullable=True))
op.add_column('farmer', sa.Column('uptime', sa.Interval(), nullable=True))
op.create_index(op.f('ix_farmer_last_seen'), 'farmer', ['last_seen'], unique=False)
op.create_index(op.f('ix_farmer_last_seen'), 'farmer', ['last_seen'], unique=False)
farmer = sa.table('farmer',sa.column('reg_time'),sa.column('uptime'))
op.execute(farmer.update().values(reg_time=datetime.utcnow()))
op.execute(farmer.update().values(uptime=0))
### end Alembic commands ###


Expand Down

0 comments on commit 2406a39

Please sign in to comment.