-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from UST-QuAntiL/fix/migration-sqlite
Fix migration for sqlite
- Loading branch information
Showing
4 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
migrations/versions/ae51830d0cb5_.py → ...ersions/ae51830d0cb5_initial_migration.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""empty message | ||
"""Initial migration. | ||
Revision ID: ae51830d0cb5 | ||
Revises: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Change id column in Table DataBlob to a key column for text based primary keys. | ||
Revision ID: b889171b490f | ||
Revises: a09e03db46a1 | ||
Create Date: 2023-11-09 12:33:37.697251 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b889171b490f" | ||
down_revision = "a09e03db46a1" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# drop and recreate table in cse some data is already present | ||
# should not be the case before this migration | ||
op.drop_table("DataBlob") | ||
op.create_table( | ||
"DataBlob", | ||
sa.Column("plugin_id", sa.String(length=550), nullable=False, primary_key=True), | ||
sa.Column("key", sa.String(500), primary_key=True), | ||
sa.Column("value", sa.LargeBinary(), nullable=False), | ||
sa.PrimaryKeyConstraint("plugin_id", "key", name=op.f("pk_DataBlob")), | ||
) | ||
|
||
|
||
def downgrade(): | ||
# drop new table and recreate old version | ||
op.drop_table("DataBlob") | ||
op.create_table( | ||
"DataBlob", | ||
sa.Column("id", sa.INTEGER(), nullable=False), | ||
sa.Column("plugin_id", sa.String(length=550), nullable=False), | ||
sa.Column("value", sa.LargeBinary(), nullable=False), | ||
sa.PrimaryKeyConstraint("id", "plugin_id", name=op.f("pk_DataBlob")), | ||
) |
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