7c3fcf8a3335_add_plugin_tables.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """Add plugin tables
  2. Revision ID: 7c3fcf8a3335
  3. Revises:
  4. Create Date: 2017-08-12 12:41:04.725309
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '7c3fcf8a3335'
  10. down_revision = None
  11. branch_labels = ('default',)
  12. depends_on = None
  13. def upgrade():
  14. # ### commands auto generated by Alembic - please adjust! ###
  15. op.create_table('plugin_registry',
  16. sa.Column('id', sa.Integer(), nullable=False),
  17. sa.Column('name', sa.Unicode(length=255), nullable=False),
  18. sa.Column('enabled', sa.Boolean(), nullable=True),
  19. sa.PrimaryKeyConstraint('id'),
  20. sa.UniqueConstraint('name')
  21. )
  22. op.create_table('plugin_store',
  23. sa.Column('id', sa.Integer(), nullable=False),
  24. sa.Column('name', sa.Unicode(length=255), nullable=False),
  25. sa.Column('value', sa.Unicode(length=255), nullable=True),
  26. sa.Column('plugin_id', sa.Integer(), nullable=True),
  27. sa.ForeignKeyConstraint(['plugin_id'], ['plugin_registry.id'], ),
  28. sa.PrimaryKeyConstraint('id'),
  29. sa.UniqueConstraint('name', 'plugin_id', name='plugin_kv_uniq')
  30. )
  31. # ### end Alembic commands ###
  32. def downgrade():
  33. # ### commands auto generated by Alembic - please adjust! ###
  34. op.drop_table('plugin_store')
  35. op.drop_table('plugin_registry')
  36. # ### end Alembic commands ###