-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ticket 37 - made changes for alembic revision script
- Loading branch information
Nargis Sultani
committed
Oct 18, 2023
1 parent
773cbb0
commit 00dfe44
Showing
9 changed files
with
86 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
db_revisions/versions/ed7dcc6128bc_create_a_baseline_migrations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""Create a baseline migrations | ||
Revision ID: ed7dcc6128bc | ||
Revises: | ||
Create Date: 2023-10-18 11:13:57.509078 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'ed7dcc6128bc' | ||
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(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.PrimaryKeyConstraint('domain', name='denied_domains_pkey') | ||
) | ||
op.create_index('ix_denied_domains_domain', 'denied_domains', ['domain'], unique=True) | ||
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(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.PrimaryKeyConstraint('lei', name='financial_institutions_pkey') | ||
) | ||
op.create_index('ix_financial_institutions_lei', 'financial_institutions', ['lei'], unique=True) | ||
op.create_index('ix_financial_institutions_name', 'financial_institutions', ['name'], unique=False) | ||
op.create_table('financial_institutions_domains', | ||
sa.Column('domain', sa.String(), nullable=False), | ||
sa.Column('lei', sa.String(), nullable=False), | ||
sa.Column('event_time', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.ForeignKeyConstraint(['lei'], ['financial_institutions.lei'], ), | ||
sa.PrimaryKeyConstraint('domain', 'lei', name='financial_institution_domains_pkey') | ||
) | ||
op.create_index('ix_financial_institution_domains_domain', 'financial_institutions_domains', ['domain'], unique=False) | ||
op.create_index('ix_financial_institution_domains_lei', 'financial_institutions_domains', ['lei'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index('ix_financial_institution_domains_lei', table_name='financial_institutions_domains') | ||
op.drop_index('ix_financial_institution_domains_domain', table_name='financial_institutions_domains') | ||
op.drop_table('financial_institutions_domains') | ||
op.drop_index('ix_financial_institutions_name', table_name='financial_institutions') | ||
op.drop_index('ix_financial_institutions_lei', table_name='financial_institutions') | ||
op.drop_table('financial_institutions') | ||
op.drop_index('ix_denied_domains_domain', table_name='denied_domains') | ||
op.drop_table('denied_domains') | ||
# ### end Alembic commands ### |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters