new_contents: """Initial migration
  
  Revision ID: af64b33e950a
  Revises: 735063d71b57
  Create Date: 2018-05-08 23:18:35.150928
  
  """
  
  
  # revision identifiers, used by Alembic.
  revision = '6fd3a80ca4e0'
  down_revision = '1ed43776064f'
  branch_labels = ('mff_rams_plugin',)
  depends_on = None
  
  from alembic import op
  import sqlalchemy as sa
  import sideboard.lib.sa
  
  
  try:
      is_sqlite = op.get_context().dialect.name == 'sqlite'
  except:
      is_sqlite = False
  
  if is_sqlite:
      op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
      utcnow_server_default = "(datetime('now', 'utc'))"
  else:
      utcnow_server_default = "timezone('utc', current_timestamp)"
  
  def sqlite_column_reflect_listener(inspector, table, column_info):
      """Adds parenthesis around SQLite datetime defaults for utcnow."""
      if column_info['default'] == "datetime('now', 'utc')":
          column_info['default'] = utcnow_server_default
  
  sqlite_reflect_kwargs = {
      'listeners': [('column_reflect', sqlite_column_reflect_listener)]
  }
  
  # ===========================================================================
  # HOWTO: Handle alter statements in SQLite
  #
  # def upgrade():
  #     if is_sqlite:
  #         with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op:
  #             batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False)
  #     else:
  #         op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False)
  #
  # ===========================================================================
  
  
  def upgrade():
      op.add_column('attendee', sa.Column('comped_reason', sideboard.lib.sa.CoerceUTF8(), server_default='', nullable=False))
      op.add_column('group', sa.Column('location', sideboard.lib.sa.CoerceUTF8(), server_default='', nullable=False))
      op.add_column('group', sa.Column('power', sa.Integer(), server_default='0', nullable=False))
      op.add_column('group', sa.Column('power_fee', sa.Integer(), server_default='0', nullable=False))
      op.add_column('group', sa.Column('power_usage', sideboard.lib.sa.CoerceUTF8(), nullable=False))
      op.add_column('group', sa.Column('table_fee', sa.Integer(), server_default='0', nullable=False))
      # ### end Alembic commands ###
  
  
  def downgrade():
      op.drop_column('group', 'table_fee')
      op.drop_column('group', 'power_usage')
      op.drop_column('group', 'power_fee')
      op.drop_column('group', 'power')
      op.drop_column('group', 'location')
      op.drop_column('attendee', 'comped_reason')
  
subject: Add initial DB migrations This is now needed to have these columns in the DB.