-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alembic migration and rename source column to label
- Loading branch information
1 parent
92b8c00
commit d3796f5
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
thoth/storages/data/alembic/versions/2b787ddad4a4_separate_the_project_url_column_from_.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,44 @@ | ||
"""Separate the project_url column from the python_package_metadata_project_url table into two columns label and url | ||
Revision ID: 2b787ddad4a4 | ||
Revises: 930b47e27b6c | ||
Create Date: 2022-01-31 16:26:38.049747+00:00 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "2b787ddad4a4" | ||
down_revision = "930b47e27b6c" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column("has_symbol", "software_environment_id", existing_type=sa.INTEGER(), nullable=False) | ||
op.alter_column("has_symbol", "versioned_symbol_id", existing_type=sa.INTEGER(), nullable=False) | ||
op.add_column("python_package_metadata_project_url", sa.Column("url", sa.Text(), nullable=True)) | ||
op.add_column("python_package_metadata_project_url", sa.Column("label", sa.Text(), nullable=True)) | ||
op.drop_column("python_package_metadata_project_url", "project_url") | ||
op.create_unique_constraint(None, "python_package_version_entity_rule", ["id"]) | ||
op.drop_index("thoth_s2i_image_name", table_name="software_environment") | ||
op.create_index("thoth_image_name", "software_environment", ["thoth_image_version"], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index("thoth_image_name", table_name="software_environment") | ||
op.create_index("thoth_s2i_image_name", "software_environment", ["thoth_image_version"], unique=False) | ||
op.drop_constraint(None, "python_package_version_entity_rule", type_="unique") | ||
op.add_column( | ||
"python_package_metadata_project_url", sa.Column("project_url", sa.TEXT(), autoincrement=False, nullable=True) | ||
) | ||
op.drop_column("python_package_metadata_project_url", "label") | ||
op.drop_column("python_package_metadata_project_url", "url") | ||
op.alter_column("has_symbol", "versioned_symbol_id", existing_type=sa.INTEGER(), nullable=True) | ||
op.alter_column("has_symbol", "software_environment_id", existing_type=sa.INTEGER(), nullable=True) | ||
# ### end Alembic commands ### |
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