def handle(self, *args, **options): db = ExportSchema.get_db() for index in ExportSchema.get_all_indices(): last = ExportSchema.last(index) if not last.timestamp: config = ExportConfiguration(db, index, disable_checkpoints=True) config.create_new_checkpoint() assert ExportSchema.last(index).timestamp print "set timestamp for %s" % index else: print "%s all set" % index
def rebuild_schemas(index): """ Resets the schema for all checkpoints to the latest version based off the current document structure. Returns the number of checkpoints updated. """ db = ExportSchema.get_db() all_checkpoints = ExportSchema.get_all_checkpoints(index) config = ExportConfiguration(db, index, disable_checkpoints=True) latest = config.create_new_checkpoint() for cp in all_checkpoints: cp.schema = latest.schema cp.save() return len(all_checkpoints)