text: # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
  # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
  # Created By: anze@reciprocitylabs.com
  # Maintained By: anze@reciprocitylabs.com
  
  
  """Add secondary contact columns
  
  Revision ID: 36950678299f
  Revises: 5156e813935f
  Create Date: 2015-01-22 19:41:49.775885
  
  """
  
  # revision identifiers, used by Alembic.
  revision = '36950678299f'
  down_revision = '5156e813935f'
  
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import mysql
  
  def upgrade():
      ### commands auto generated by Alembic - please adjust! ###
      op.add_column('audits', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_audits_secondary_contact', 'audits', ['secondary_contact_id'], unique=False)
      op.add_column('controls', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_controls_secondary_contact', 'controls', ['secondary_contact_id'], unique=False)
      op.add_column('data_assets', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_data_assets_secondary_contact', 'data_assets', ['secondary_contact_id'], unique=False)
      op.add_column('directives', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_directives_secondary_contact', 'directives', ['secondary_contact_id'], unique=False)
      op.add_column('facilities', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_facilities_secondary_contact', 'facilities', ['secondary_contact_id'], unique=False)
      op.add_column('markets', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_markets_secondary_contact', 'markets', ['secondary_contact_id'], unique=False)
      op.add_column('objectives', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_objectives_secondary_contact', 'objectives', ['secondary_contact_id'], unique=False)
      op.add_column('org_groups', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_org_groups_secondary_contact', 'org_groups', ['secondary_contact_id'], unique=False)
      op.add_column('products', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_products_secondary_contact', 'products', ['secondary_contact_id'], unique=False)
      op.add_column('programs', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_programs_secondary_contact', 'programs', ['secondary_contact_id'], unique=False)
      op.add_column('projects', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_projects_secondary_contact', 'projects', ['secondary_contact_id'], unique=False)
      op.add_column('responses', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_responses_secondary_contact', 'responses', ['secondary_contact_id'], unique=False)
      op.add_column('sections', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_sections_secondary_contact', 'sections', ['secondary_contact_id'], unique=False)
      op.add_column('systems', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_systems_secondary_contact', 'systems', ['secondary_contact_id'], unique=False)
      op.add_column('vendors', sa.Column('secondary_contact_id', sa.Integer(), nullable=True))
      op.create_index('fk_vendors_secondary_contact', 'vendors', ['secondary_contact_id'], unique=False)
      ### end Alembic commands ###
  
  def downgrade():
      ### commands auto generated by Alembic - please adjust! ###
      op.drop_index('fk_vendors_secondary_contact', table_name='vendors')
      op.drop_column('vendors', 'secondary_contact_id')
      op.drop_index('fk_systems_secondary_contact', table_name='systems')
      op.drop_column('systems', 'secondary_contact_id')
      op.drop_index('fk_sections_secondary_contact', table_name='sections')
      op.drop_column('sections', 'secondary_contact_id')
      op.drop_index('fk_responses_secondary_contact', table_name='responses')
      op.drop_column('responses', 'secondary_contact_id')
      op.drop_index('fk_projects_secondary_contact', table_name='projects')
      op.drop_column('projects', 'secondary_contact_id')
      op.drop_index('fk_programs_secondary_contact', table_name='programs')
      op.drop_column('programs', 'secondary_contact_id')
      op.drop_index('fk_products_secondary_contact', table_name='products')
      op.drop_column('products', 'secondary_contact_id')
      op.drop_index('fk_org_groups_secondary_contact', table_name='org_groups')
      op.drop_column('org_groups', 'secondary_contact_id')
      op.drop_index('fk_objectives_secondary_contact', table_name='objectives')
      op.drop_column('objectives', 'secondary_contact_id')
      op.drop_index('fk_markets_secondary_contact', table_name='markets')
      op.drop_column('markets', 'secondary_contact_id')
      op.drop_index('fk_facilities_secondary_contact', table_name='facilities')
      op.drop_column('facilities', 'secondary_contact_id')
      op.drop_index('fk_directives_secondary_contact', table_name='directives')
      op.drop_column('directives', 'secondary_contact_id')
      op.drop_index('fk_data_assets_secondary_contact', table_name='data_assets')
      op.drop_column('data_assets', 'secondary_contact_id')
      op.drop_index('fk_controls_secondary_contact', table_name='controls')
      op.drop_column('controls', 'secondary_contact_id')
      op.drop_index('fk_audits_secondary_contact', table_name='audits')
      op.drop_column('audits', 'secondary_contact_id')
      ### end Alembic commands ###
  