Skip to content

Commit

Permalink
Re-add new pulp modularity support
Browse files Browse the repository at this point in the history
This reverts commit 7281065.

Resolves: AlmaLinux/build-system#151
  • Loading branch information
javihernandez committed Mar 15, 2024
1 parent 67007f8 commit df03b47
Show file tree
Hide file tree
Showing 35 changed files with 1,648 additions and 751 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.git-cacher
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM almalinux:8

RUN mkdir -p /code && \
yum update -y && \
yum install python3-virtualenv python38 -y && \
yum install python3-virtualenv python38 git -y && \
yum clean all
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -o wait_for_it.sh && chmod +x wait_for_it.sh
COPY ./alws/scripts/git_cacher/requirements.txt /code/requirements.txt
Expand Down
74 changes: 74 additions & 0 deletions alws/alembic/versions/07dad1dc5105_migrate_pulp_modules.py
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 ###
Loading

0 comments on commit df03b47

Please sign in to comment.