Merge pull request #2539 from coreos-inc/backfill-rss
Add backfill for repository search score table
This commit is contained in:
commit
cfff194fb2
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