Skip to content

Commit

Permalink
added testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nargis Sultani committed Oct 23, 2023
1 parent bafe7b7 commit 1e09290
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 64 deletions.
59 changes: 59 additions & 0 deletions db_revisions/versions/26556a57a06f_create_a_baseline_migrations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Create a baseline migrations
Revision ID: 26556a57a06f
Revises:
Create Date: 2023-10-23 04:04:07.722956
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '26556a57a06f'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('denied_domains',
sa.Column('domain', sa.String(), nullable=False),
sa.Column('event_time', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.PrimaryKeyConstraint('domain')
)
op.create_index(op.f('ix_denied_domains_domain'), 'denied_domains', ['domain'], unique=False)
op.create_table('financial_institutions',
sa.Column('lei', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('event_time', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.PrimaryKeyConstraint('lei')
)
op.create_index(op.f('ix_financial_institutions_lei'), 'financial_institutions', ['lei'], unique=True)
op.create_index(op.f('ix_financial_institutions_name'), 'financial_institutions', ['name'], unique=False)
op.create_table('financial_institution_domains',
sa.Column('domain', sa.String(), nullable=False),
sa.Column('lei', sa.String(), nullable=False),
sa.Column('event_time', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['lei'], ['public.financial_institutions.lei'], ),
sa.PrimaryKeyConstraint('domain', 'lei')
)
op.create_index(op.f('ix_financial_institution_domains_domain'), 'financial_institution_domains', ['domain'], unique=False)
op.create_index(op.f('ix_financial_institution_domains_lei'), 'financial_institution_domains', ['lei'], unique=False)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_financial_institution_domains_lei'), table_name='financial_institution_domains')
op.drop_index(op.f('ix_financial_institution_domains_domain'), table_name='financial_institution_domains')
op.drop_table('financial_institution_domains')
op.drop_index(op.f('ix_financial_institutions_name'), table_name='financial_institutions')
op.drop_index(op.f('ix_financial_institutions_lei'), table_name='financial_institutions')
op.drop_table('financial_institutions')
op.drop_index(op.f('ix_denied_domains_domain'), table_name='denied_domains')
op.drop_table('denied_domains')
# ### end Alembic commands ###
60 changes: 0 additions & 60 deletions db_revisions/versions/5ef8007003c6_create_a_baseline_migrations.py

This file was deleted.

8 changes: 4 additions & 4 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pytest_alembic.tests import (
test_model_definitions_match_ddl,
test_single_head_revision,
test_up_down_consistency,
test_upgrade,
test_model_definitions_match_ddl, # noqa: F401
test_single_head_revision, # noqa: F401
test_up_down_consistency, # noqa: F401
test_upgrade, # noqa: F401
)

0 comments on commit 1e09290

Please sign in to comment.