-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 7281065. Resolves: AlmaLinux/build-system#151
- Loading branch information
1 parent
67007f8
commit df03b47
Showing
35 changed files
with
1,648 additions
and
751 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
74 changes: 74 additions & 0 deletions
74
alws/alembic/versions/07dad1dc5105_migrate_pulp_modules.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,74 @@ | ||
"""Migrate Pulp modules | ||
Revision ID: 07dad1dc5105 | ||
Revises: 6a7bbafb88c5 | ||
Create Date: 2024-02-02 16:17:33.965562 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '07dad1dc5105' | ||
down_revision = '6a7bbafb88c5' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
'build_tasks_rpm_modules_mapping', | ||
sa.Column('build_task_id', sa.Integer(), nullable=False), | ||
sa.Column('rpm_module_id', sa.Integer(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
['build_task_id'], | ||
['build_tasks.id'], | ||
name="build_tasks_rpm_modules_mapping_build_task_id_fkey", | ||
), | ||
sa.ForeignKeyConstraint( | ||
['rpm_module_id'], | ||
['rpm_module.id'], | ||
name="build_tasks_rpm_modules_mapping_rpm_module_id_fkey", | ||
), | ||
sa.PrimaryKeyConstraint('build_task_id', 'rpm_module_id'), | ||
) | ||
op.execute( | ||
sa.text( | ||
"INSERT INTO build_tasks_rpm_modules_mapping (build_task_id, rpm_module_id) " | ||
"SELECT DISTINCT id, rpm_module_id FROM build_tasks " | ||
"WHERE rpm_module_id IS NOT NULL" | ||
) | ||
) | ||
op.drop_constraint( | ||
'build_tasks_rpm_module_id_fkey', 'build_tasks', type_='foreignkey' | ||
) | ||
op.drop_column('build_tasks', 'rpm_module_id') | ||
op.drop_column('rpm_module', 'sha256') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
'rpm_module', | ||
sa.Column( | ||
'sha256', sa.VARCHAR(length=64), autoincrement=False, nullable=True | ||
), | ||
) | ||
op.add_column( | ||
'build_tasks', | ||
sa.Column( | ||
'rpm_module_id', sa.INTEGER(), autoincrement=False, nullable=True | ||
), | ||
) | ||
op.create_foreign_key( | ||
'build_tasks_rpm_module_id_fkey', | ||
'build_tasks', | ||
'rpm_module', | ||
['rpm_module_id'], | ||
['id'], | ||
) | ||
op.drop_table('build_tasks_rpm_modules_mapping') | ||
# ### end Alembic commands ### |
Oops, something went wrong.