-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: add relationship between actions and projects/builds #2805
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Connect Copr to Actions | ||
|
||
Revision ID: 08dd42f4c304 | ||
Create Date: 2023-08-03 15:45:53.527538 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '08dd42f4c304' | ||
down_revision = 'daa62cd0743d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column('action', sa.Column('copr_id', sa.Integer(), nullable=True)) | ||
op.create_index(op.f('ix_action_copr_id'), 'action', ['copr_id'], unique=False) | ||
op.create_foreign_key(None, 'action', 'copr', ['copr_id'], ['id']) | ||
|
||
|
||
def downgrade(): | ||
op.drop_constraint(None, 'action', type_='foreignkey') | ||
op.drop_index(op.f('ix_action_copr_id'), table_name='action') | ||
op.drop_column('action', 'copr_id') |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -840,8 +840,8 @@ def send_delete_dirs_action(cls): | |
""" | ||
copr_ids = cls.get_copr_ids_with_pr_dirs().all() | ||
|
||
remove_dirs = [] | ||
for copr_id in copr_ids: | ||
remove_dirs = [] | ||
copr_id = copr_id[0] | ||
all_dirs = cls.get_all_with_latest_submitted_build(copr_id) | ||
for copr_dir in all_dirs: | ||
|
@@ -857,13 +857,14 @@ def send_delete_dirs_action(cls): | |
cls.delete_with_builds(dir_object) | ||
remove_dirs.append(dirname) | ||
|
||
action = models.Action( | ||
action_type=ActionTypeEnum("remove_dirs"), | ||
object_type="copr", | ||
data=json.dumps(remove_dirs), | ||
created_on=int(time.time())) | ||
|
||
db.session.add(action) | ||
action = models.Action( | ||
action_type=ActionTypeEnum("remove_dirs"), | ||
object_type="copr", | ||
data=json.dumps(remove_dirs), | ||
created_on=int(time.time()), | ||
copr_id=copr_id, | ||
) | ||
db.session.add(action) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is weird, is the indent change intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this sounds good, thanks! |
||
|
||
@classmethod | ||
def copr_name_from_dirname(cls, dirname): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this.