Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
migration for target table
Browse files Browse the repository at this point in the history
Summary: This contains the migration code for the Bazel target table.

Test Plan: manual testing

Reviewers: anupc

Reviewed By: anupc

Subscribers: changesbot, kylec

Differential Revision: https://tails.corp.dropbox.com/D224290
  • Loading branch information
Naphat Sanguansin committed Aug 30, 2016
1 parent 52e3716 commit 9f69149
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions migrations/versions/28374b800521_added_target_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Added target table
Revision ID: 28374b800521
Revises: 460741ff1212
Create Date: 2016-08-24 23:55:14.231624
"""

# revision identifiers, used by Alembic.
revision = '28374b800521'
down_revision = '460741ff1212'

from alembic import op
import sqlalchemy as sa


def upgrade():
op.create_table(
'bazeltarget',
sa.Column('id', sa.GUID(), nullable=False),
sa.Column('step_id', sa.GUID(), nullable=False),
sa.Column('job_id', sa.GUID(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('status', sa.Enum(), nullable=False),
sa.Column('result', sa.Enum(), nullable=False),
sa.Column('duration', sa.Integer(), nullable=True),
sa.Column('date_created', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(
['step_id'], ['jobstep.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(
['job_id'], ['job.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.add_column('test', sa.Column('target_id', sa.GUID(), nullable=True))
op.create_foreign_key('test_target_id_fkey', 'test', 'bazeltarget', ['target_id'], ['id'], ondelete='CASCADE')


def downgrade():
op.drop_constraint('test_target_id_fkey', 'test')
op.drop_column('test', 'target_id')
op.drop_table('bazeltarget')

0 comments on commit 9f69149

Please sign in to comment.