Skip to content

Commit

Permalink
Add auto-generated migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sahilph committed Apr 3, 2022
1 parent aec499e commit 25a56ec
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions migrations/versions/2022_040221_b26e402d2e0e_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""empty message
Revision ID: b26e402d2e0e
Revises: b500363567e3
Create Date: 2022-04-02 21:47:30.243843
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'b26e402d2e0e'
down_revision = 'b500363567e3'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('SMTP_credentials',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('alias_id', sa.Integer(), nullable=False),
sa.Column('password', sa.String(length=128), nullable=False),
sa.ForeignKeyConstraint(['alias_id'], ['alias.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('alias_id', name='uq_alias')
)
op.create_index(op.f('ix_SMTP_credentials_alias_id'), 'SMTP_credentials', ['alias_id'], unique=True)
op.alter_column('admin_audit_log', 'data',
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=True)
op.drop_index('admin_audit_log_admin_user_id_idx', table_name='admin_audit_log')
op.drop_constraint('admin_audit_log_admin_user_id_fkey', 'admin_audit_log', type_='foreignkey')
op.create_foreign_key(None, 'admin_audit_log', 'users', ['admin_user_id'], ['id'])
op.add_column('alias', sa.Column('enable_SMTP', sa.Boolean(), server_default='0', nullable=False))
op.add_column('email_log', sa.Column('is_SMTP', sa.Boolean(), nullable=False))
op.add_column('users', sa.Column('enable_SMTP_aliases', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'enable_SMTP_aliases')
op.drop_column('email_log', 'is_SMTP')
op.drop_column('alias', 'enable_SMTP')
op.drop_constraint(None, 'admin_audit_log', type_='foreignkey')
op.create_foreign_key('admin_audit_log_admin_user_id_fkey', 'admin_audit_log', 'users', ['admin_user_id'], ['id'], ondelete='CASCADE')
op.create_index('admin_audit_log_admin_user_id_idx', 'admin_audit_log', ['admin_user_id'], unique=False)
op.alter_column('admin_audit_log', 'data',
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=False)
op.drop_index(op.f('ix_SMTP_credentials_alias_id'), table_name='SMTP_credentials')
op.drop_table('SMTP_credentials')
# ### end Alembic commands ###

0 comments on commit 25a56ec

Please sign in to comment.