-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create migration that updates tables to new standards
- Loading branch information
1 parent
0534ce4
commit c5fecbd
Showing
2 changed files
with
42 additions
and
8 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
30 changes: 30 additions & 0 deletions
30
migrations/versions/5ffe5a5c8e9a_update_entities_to_match_metadata.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,30 @@ | ||
"""update entities to match metadata | ||
Revision ID: 5ffe5a5c8e9a | ||
Revises: 46aedec8fd9b | ||
Create Date: 2024-09-20 17:09:10.819963 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5ffe5a5c8e9a" | ||
down_revision = "46aedec8fd9b" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.execute(sa.text("ALTER INDEX invite_code_code_key RENAME TO uq_invite_codes_code")) | ||
op.execute(sa.text("ALTER INDEX usernames_username_key RENAME TO uq_usernames_username")) | ||
op.execute(sa.text("ALTER TABLE invite_code RENAME TO invite_codes")) | ||
op.execute(sa.text("ALTER TABLE message RENAME TO messages")) | ||
|
||
|
||
def downgrade() -> None: | ||
op.execute(sa.text("ALTER INDEX uq_usernames_username RENAME TO usernames_username_key")) | ||
op.execute(sa.text("ALTER TABLE messages RENAME TO message")) | ||
op.execute(sa.text("ALTER TABLE invite_codes RENAME TO invite_code")) | ||
op.execute(sa.text("ALTER INDEX uq_invite_codes_code RENAME TO invite_code_code_key")) |