~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/migrations/versions/018_delete_all_bundles.py

[r=sinzui][bug=][author=benji] - Remove useless try/except accidentally left in store_bundles from last
  branch
- add migration 018 which removes all bundles from the DB and ES (they
  will be repopulated at the next ingestion)
- add an explicit construct_search_id so it is easier to see the
  semantics of ID creation when reading the code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2013 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
from pyelasticsearch.exceptions import ElasticHttpNotFoundError
 
5
 
 
6
from charmworld.search import BUNDLE
 
7
 
 
8
def upgrade(db, index_client):
 
9
    db.bundles.remove({}, False)
 
10
    index_client._client.delete_all(index_client.index_name, BUNDLE)