-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c825b13
commit d054fbb
Showing
8 changed files
with
106 additions
and
14 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 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 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 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,34 @@ | ||
"""initial | ||
Revision ID: 1730636773 | ||
Revises: | ||
Create Date: 2024-11-03 12:26:13.593575 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '1730636773' | ||
down_revision: Union[str, None] = None | ||
branch_labels: Union[str, Sequence[str], None] = ('default',) | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table('secret', | ||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), | ||
sa.Column('encrypted_text', postgresql.BYTEA(), autoincrement=False, nullable=True), | ||
sa.Column('date_created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), | ||
sa.Column('date_expires', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), | ||
sa.Column('external_id', sa.VARCHAR(length=20), autoincrement=False, nullable=False), | ||
sa.Column('tries', sa.INTEGER(), autoincrement=False, nullable=True), | ||
sa.PrimaryKeyConstraint('id', name='secret_pkey') | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table('secret') |
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,27 @@ | ||
"""add indexes | ||
Revision ID: 1730637997 | ||
Revises: 1730636773 | ||
Create Date: 2024-11-03 12:46:37.418955 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '1730637997' | ||
down_revision: Union[str, None] = '1730636773' | ||
branch_labels: Union[str, Sequence[str], None] = () | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index('date_expires_idx', 'secret', ['date_expires'], unique=False) | ||
op.create_index('external_id_idx', 'secret', ['external_id'], unique=False) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index('external_id_idx', table_name='secret') | ||
op.drop_index('date_expires_idx', table_name='secret') |
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,26 @@ | ||
"""${message} | ||
|
||
Revision ID: ${up_revision} | ||
Revises: ${down_revision | comma,n} | ||
Create Date: ${create_date} | ||
|
||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
${imports if imports else ""} | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = ${repr(up_revision)} | ||
down_revision: Union[str, None] = ${repr(down_revision)} | ||
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)} | ||
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} | ||
|
||
|
||
def upgrade() -> None: | ||
${upgrades if upgrades else "pass"} | ||
|
||
|
||
def downgrade() -> None: | ||
${downgrades if downgrades else "pass"} |