Add backfill for repository search score table
This commit is contained in:
parent
c78ec89305
commit
68331859b0
1 changed files with 23 additions and 0 deletions
|
@ -0,0 +1,23 @@
|
|||
"""Backfill RepositorySearchScore table
|
||||
|
||||
Revision ID: c3d4b7ebcdf7
|
||||
Revises: f30984525c86
|
||||
Create Date: 2017-04-13 12:01:59.572775
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c3d4b7ebcdf7'
|
||||
down_revision = 'f30984525c86'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
def upgrade(tables):
|
||||
# Add a 0 entry into the RepositorySearchScore table for each repository that isn't present
|
||||
conn = op.get_bind()
|
||||
conn.execute("insert into repositorysearchscore (repository_id, score) SELECT id, 0 FROM " +
|
||||
"repository WHERE id not in (select repository_id from repositorysearchscore)")
|
||||
|
||||
def downgrade(tables):
|
||||
pass
|
Reference in a new issue