text: """empty message
  
  Revision ID: be9e8ae40412
  Revises: 
  Create Date: 2019-05-22 23:07:15.908255
  
  """
  from alembic import op
  import sqlalchemy as sa
  
  
  # revision identifiers, used by Alembic.
  revision = 'be9e8ae40412'
  down_revision = None
  branch_labels = None
  depends_on = None
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table('group',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('platform', sa.String(length=10), nullable=False),
      sa.Column('group_id', sa.String(length=20), nullable=False),
      sa.Column('group_name', sa.String(length=50), nullable=False),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('platform', 'group_id', name='c_group')
      )
      op.create_index(op.f('ix_group_group_id'), 'group', ['group_id'], unique=False)
      op.create_index(op.f('ix_group_platform'), 'group', ['platform'], unique=False)
      op.create_table('main_user',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('username', sa.String(length=64), nullable=False),
      sa.Column('email', sa.String(length=120), nullable=False),
      sa.Column('password_hash', sa.String(length=128), nullable=False),
      sa.PrimaryKeyConstraint('id')
      )
      op.create_index(op.f('ix_main_user_email'), 'main_user', ['email'], unique=True)
      op.create_index(op.f('ix_main_user_username'), 'main_user', ['username'], unique=True)
      op.create_table('article',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('title', sa.String(length=128), nullable=False),
      sa.Column('author', sa.String(length=128), nullable=True),
      sa.Column('content_type', sa.String(length=64), nullable=True),
      sa.Column('content', sa.Text(), nullable=False),
      sa.Column('hash', sa.String(length=128), nullable=False),
      sa.Column('length', sa.Integer(), nullable=False),
      sa.Column('special_chars', sa.String(length=2040), nullable=False),
      sa.Column('main_user_id', sa.Integer(), nullable=True),
      sa.ForeignKeyConstraint(['main_user_id'], ['main_user.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('title', 'hash', 'length', name='c_article')
      )
      op.create_index(op.f('ix_article_author'), 'article', ['author'], unique=False)
      op.create_index(op.f('ix_article_content_type'), 'article', ['content_type'], unique=False)
      op.create_index(op.f('ix_article_length'), 'article', ['length'], unique=False)
      op.create_index(op.f('ix_article_main_user_id'), 'article', ['main_user_id'], unique=False)
      op.create_index(op.f('ix_article_title'), 'article', ['title'], unique=False)
      op.create_table('chars_table',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('name', sa.String(length=64), nullable=False),
      sa.Column('version', sa.String(length=20), nullable=False),
      sa.Column('group_db_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['group_db_id'], ['group.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('name'),
      sa.UniqueConstraint('name', 'version', name='c_chars_table')
      )
      op.create_index(op.f('ix_chars_table_group_db_id'), 'chars_table', ['group_db_id'], unique=False)
      op.create_index(op.f('ix_chars_table_version'), 'chars_table', ['version'], unique=False)
      op.create_table('comp_article',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('title', sa.String(length=128), nullable=False),
      sa.Column('producer', sa.String(length=128), nullable=True),
      sa.Column('content_type', sa.String(length=64), nullable=True),
      sa.Column('content', sa.Text(), nullable=False),
      sa.Column('length', sa.Integer(), nullable=False),
      sa.Column('hash', sa.String(length=128), nullable=False),
      sa.Column('date', sa.Date(), nullable=False),
      sa.Column('number', sa.Integer(), nullable=False),
      sa.Column('comp_type', sa.String(length=128), nullable=False),
      sa.Column('level', sa.Integer(), nullable=True),
      sa.Column('group_db_id', sa.Integer(), nullable=True),
      sa.ForeignKeyConstraint(['group_db_id'], ['group.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('date', 'group_db_id', name='c_comp_article_3'),
      sa.UniqueConstraint('number', 'group_db_id', 'comp_type', name='c_comp_article_2'),
      sa.UniqueConstraint('title', 'hash', 'length', 'group_db_id', name='c_comp_article_1')
      )
      op.create_index(op.f('ix_comp_article_comp_type'), 'comp_article', ['comp_type'], unique=False)
      op.create_index(op.f('ix_comp_article_content_type'), 'comp_article', ['content_type'], unique=False)
      op.create_index(op.f('ix_comp_article_date'), 'comp_article', ['date'], unique=False)
      op.create_index(op.f('ix_comp_article_group_db_id'), 'comp_article', ['group_db_id'], unique=False)
      op.create_index(op.f('ix_comp_article_length'), 'comp_article', ['length'], unique=False)
      op.create_index(op.f('ix_comp_article_producer'), 'comp_article', ['producer'], unique=False)
      op.create_index(op.f('ix_comp_article_title'), 'comp_article', ['title'], unique=False)
      op.create_table('comp_article_box',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('title', sa.String(length=128), nullable=False),
      sa.Column('author', sa.String(length=128), nullable=True),
      sa.Column('content_type', sa.String(length=64), nullable=True),
      sa.Column('content', sa.Text(), nullable=False),
      sa.Column('hash', sa.String(length=128), nullable=False),
      sa.Column('length', sa.Integer(), nullable=False),
      sa.Column('main_user_id', sa.Integer(), nullable=True),
      sa.Column('box_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['main_user_id'], ['main_user.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('hash', 'length', 'main_user_id', name='c_article')
      )
      op.create_index(op.f('ix_comp_article_box_author'), 'comp_article_box', ['author'], unique=False)
      op.create_index(op.f('ix_comp_article_box_box_id'), 'comp_article_box', ['box_id'], unique=False)
      op.create_index(op.f('ix_comp_article_box_content_type'), 'comp_article_box', ['content_type'], unique=False)
      op.create_index(op.f('ix_comp_article_box_length'), 'comp_article_box', ['length'], unique=False)
      op.create_index(op.f('ix_comp_article_box_main_user_id'), 'comp_article_box', ['main_user_id'], unique=False)
      op.create_index(op.f('ix_comp_article_box_title'), 'comp_article_box', ['title'], unique=False)
      op.create_table('group_user',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('platform', sa.String(length=10), nullable=False),
      sa.Column('user_id', sa.String(length=20), nullable=False),
      sa.Column('username', sa.String(length=50), nullable=False),
      sa.Column('main_user_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['main_user_id'], ['main_user.id'], ),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('platform', 'user_id', name='c_group_user')
      )
      op.create_index(op.f('ix_group_user_main_user_id'), 'group_user', ['main_user_id'], unique=False)
      op.create_index(op.f('ix_group_user_platform'), 'group_user', ['platform'], unique=False)
      op.create_index(op.f('ix_group_user_user_id'), 'group_user', ['user_id'], unique=False)
      op.create_table('words_table',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('name', sa.String(length=64), nullable=False),
      sa.Column('version', sa.String(length=20), nullable=False),
      sa.Column('group_db_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['group_db_id'], ['group.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('name', 'version', name='c_words_table')
      )
      op.create_index(op.f('ix_words_table_group_db_id'), 'words_table', ['group_db_id'], unique=False)
      op.create_index(op.f('ix_words_table_name'), 'words_table', ['name'], unique=True)
      op.create_index(op.f('ix_words_table_version'), 'words_table', ['version'], unique=False)
      op.create_table('character',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('char', sa.String(length=6), nullable=False),
      sa.Column('codes', sa.String(length=64), nullable=False),
      sa.Column('split', sa.String(length=200), nullable=True),
      sa.Column('other_info', sa.String(length=200), nullable=True),
      sa.Column('table_db_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['table_db_id'], ['chars_table.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('table_db_id', 'char', name='c_char')
      )
      op.create_index(op.f('ix_character_char'), 'character', ['char'], unique=False)
      op.create_index(op.f('ix_character_table_db_id'), 'character', ['table_db_id'], unique=False)
      op.create_table('group_user_relation',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('platform', sa.String(length=10), nullable=False),
      sa.Column('group_db_id', sa.Integer(), nullable=False),
      sa.Column('user_db_id', sa.Integer(), nullable=False),
      sa.Column('is_admin', sa.Boolean(), nullable=False),
      sa.Column('is_owner', sa.Boolean(), nullable=False),
      sa.ForeignKeyConstraint(['group_db_id'], ['group.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.ForeignKeyConstraint(['user_db_id'], ['group_user.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('platform', 'user_db_id', 'group_db_id', name='c_relation')
      )
      op.create_index(op.f('ix_group_user_relation_group_db_id'), 'group_user_relation', ['group_db_id'], unique=False)
      op.create_index(op.f('ix_group_user_relation_platform'), 'group_user_relation', ['platform'], unique=False)
      op.create_index(op.f('ix_group_user_relation_user_db_id'), 'group_user_relation', ['user_db_id'], unique=False)
      op.create_table('word',
      sa.Column('id', sa.Integer(), nullable=False),
      sa.Column('word', sa.String(length=6), nullable=False),
      sa.Column('position', sa.Integer(), nullable=False),
      sa.Column('code', sa.String(length=12), nullable=False),
      sa.Column('table_db_id', sa.Integer(), nullable=False),
      sa.ForeignKeyConstraint(['table_db_id'], ['words_table.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.PrimaryKeyConstraint('id'),
      sa.UniqueConstraint('table_db_id', 'code', 'position', name='c_word')
      )
      op.create_index(op.f('ix_word_table_db_id'), 'word', ['table_db_id'], unique=False)
      op.create_index(op.f('ix_word_word'), 'word', ['word'], unique=False)
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_index(op.f('ix_word_word'), table_name='word')
      op.drop_index(op.f('ix_word_table_db_id'), table_name='word')
      op.drop_table('word')
      op.drop_index(op.f('ix_group_user_relation_user_db_id'), table_name='group_user_relation')
      op.drop_index(op.f('ix_group_user_relation_platform'), table_name='group_user_relation')
      op.drop_index(op.f('ix_group_user_relation_group_db_id'), table_name='group_user_relation')
      op.drop_table('group_user_relation')
      op.drop_index(op.f('ix_character_table_db_id'), table_name='character')
      op.drop_index(op.f('ix_character_char'), table_name='character')
      op.drop_table('character')
      op.drop_index(op.f('ix_words_table_version'), table_name='words_table')
      op.drop_index(op.f('ix_words_table_name'), table_name='words_table')
      op.drop_index(op.f('ix_words_table_group_db_id'), table_name='words_table')
      op.drop_table('words_table')
      op.drop_index(op.f('ix_group_user_user_id'), table_name='group_user')
      op.drop_index(op.f('ix_group_user_platform'), table_name='group_user')
      op.drop_index(op.f('ix_group_user_main_user_id'), table_name='group_user')
      op.drop_table('group_user')
      op.drop_index(op.f('ix_comp_article_box_title'), table_name='comp_article_box')
      op.drop_index(op.f('ix_comp_article_box_main_user_id'), table_name='comp_article_box')
      op.drop_index(op.f('ix_comp_article_box_length'), table_name='comp_article_box')
      op.drop_index(op.f('ix_comp_article_box_content_type'), table_name='comp_article_box')
      op.drop_index(op.f('ix_comp_article_box_box_id'), table_name='comp_article_box')
      op.drop_index(op.f('ix_comp_article_box_author'), table_name='comp_article_box')
      op.drop_table('comp_article_box')
      op.drop_index(op.f('ix_comp_article_title'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_producer'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_length'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_group_db_id'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_date'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_content_type'), table_name='comp_article')
      op.drop_index(op.f('ix_comp_article_comp_type'), table_name='comp_article')
      op.drop_table('comp_article')
      op.drop_index(op.f('ix_chars_table_version'), table_name='chars_table')
      op.drop_index(op.f('ix_chars_table_group_db_id'), table_name='chars_table')
      op.drop_table('chars_table')
      op.drop_index(op.f('ix_article_title'), table_name='article')
      op.drop_index(op.f('ix_article_main_user_id'), table_name='article')
      op.drop_index(op.f('ix_article_length'), table_name='article')
      op.drop_index(op.f('ix_article_content_type'), table_name='article')
      op.drop_index(op.f('ix_article_author'), table_name='article')
      op.drop_table('article')
      op.drop_index(op.f('ix_main_user_username'), table_name='main_user')
      op.drop_index(op.f('ix_main_user_email'), table_name='main_user')
      op.drop_table('main_user')
      op.drop_index(op.f('ix_group_platform'), table_name='group')
      op.drop_index(op.f('ix_group_group_id'), table_name='group')
      op.drop_table('group')
      # ### end Alembic commands ###
  