Skip to content

Commit

Permalink
Add results table.
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Nov 23, 2015
1 parent d55e1a4 commit 45f67f2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions alembic/versions/4f12d8650050_add_results_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""add results table
Revision ID: 4f12d8650050
Revises: 4a571e217ab8
Create Date: 2015-11-23 10:55:00.909453
"""

# revision identifiers, used by Alembic.
revision = '4f12d8650050'
down_revision = '4a571e217ab8'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ARRAY, JSON
import datetime


def make_timestamp():
now = datetime.datetime.utcnow()
return now.isoformat()


def upgrade():
op.create_table(
'result',
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('created', sa.Text, default=make_timestamp),
sa.Column('project_id', sa.Integer, sa.ForeignKey('project.id'), nullable=False),
sa.Column('task_id', sa.Integer, sa.ForeignKey('task.id'), nullable=False),
sa.Column('task_run_ids', ARRAY(sa.Integer), nullable=False),
sa.Column('last_version', sa.Boolean, default=True),
sa.Column('info', JSON)
)


def downgrade():
op.drop_table('result')

0 comments on commit 45f67f2

Please sign in to comment.