-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bug path length column to Bug overview
Add bug path length column to `Bug overview` table to indicate how long the report path is.
- Loading branch information
1 parent
aa2631a
commit 52589bf
Showing
8 changed files
with
104 additions
and
17 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
41 changes: 41 additions & 0 deletions
41
db_migrate/versions/7f759046740b_add_bug_path_length_to_reports.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,41 @@ | ||
"""Add bug path length to reports | ||
Revision ID: 7f759046740b | ||
Revises: 4b38fa14c27b | ||
Create Date: 2017-12-11 11:24:31.363284 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '7f759046740b' | ||
down_revision = '4b38fa14c27b' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from libcodechecker.server.database.run_db_model import * | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('reports', | ||
sa.Column('bug_path_length', sa.Integer(), nullable=True)) | ||
|
||
bind = op.get_bind() | ||
session = Session(bind=bind) | ||
|
||
session.query(Report.id).update({'bug_path_length': ( | ||
select([func.count(BugPathEvent.report_id)]) | ||
.where(BugPathEvent.report_id == Report.id) | ||
.group_by(BugPathEvent.report_id) | ||
)}, synchronize_session=False) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('reports', 'bug_path_length') | ||
# ### 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
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
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