"""Adding endpoint tables Revision ID: 29d8c8455c86 Revises: 3307381f3b88 Create Date: 2016-06-28 16:05:25.720213 """ # revision identifiers, used by Alembic. revision = "29d8c8455c86" down_revision = "3307381f3b88" from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( "ciphers", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(length=128), nullable=False), sa.PrimaryKeyConstraint("id"), ) op.create_table( "policy", sa.Column("id", sa.Integer(), nullable=False), sa.Column("name", sa.String(length=128), nullable=True), sa.PrimaryKeyConstraint("id"), ) op.create_table( "policies_ciphers", sa.Column("cipher_id", sa.Integer(), nullable=True), sa.Column("policy_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["cipher_id"], ["ciphers.id"]), sa.ForeignKeyConstraint(["policy_id"], ["policy.id"]), ) op.create_index( "policies_ciphers_ix", "policies_ciphers", ["cipher_id", "policy_id"], unique=False, ) op.create_table( "endpoints", sa.Column("id", sa.Integer(), nullable=False), sa.Column("owner", sa.String(length=128), nullable=True), sa.Column("name", sa.String(length=128), nullable=True), sa.Column("dnsname", sa.String(length=256), nullable=True), sa.Column("type", sa.String(length=128), nullable=True), sa.Column("active", sa.Boolean(), nullable=True), sa.Column("port", sa.Integer(), nullable=True), sa.Column( "date_created", sa.DateTime(), server_default=sa.text(u"now()"), nullable=False, ), sa.Column("policy_id", sa.Integer(), nullable=True), sa.Column("certificate_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["certificate_id"], ["certificates.id"]), sa.ForeignKeyConstraint(["policy_id"], ["policy.id"]), sa.PrimaryKeyConstraint("id"), ) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_table("endpoints") op.drop_index("policies_ciphers_ix", table_name="policies_ciphers") op.drop_table("policies_ciphers") op.drop_table("policy") op.drop_table("ciphers") ### end Alembic commands ###