| 10635 | */ |
| 10636 | int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run); |
| 10637 | static int cbm_install_prepare_existing_indexes(const char *home, bool reset, bool dry_run, |
| 10638 | bool *delete_indexes_out) { |
| 10639 | if (delete_indexes_out) { |
| 10640 | *delete_indexes_out = false; |
| 10641 | } |
| 10642 | int index_count = count_db_indexes(home); |
| 10643 | if (index_count <= 0) { |
| 10644 | return 1; /* nothing to handle, proceed */ |
| 10645 | } |
| 10646 | |
| 10647 | if (!reset) { |
| 10648 | /* Default: preserve. Be honest — keep the indexes, advise re-index. */ |
| 10649 | printf("Found %d existing index(es). Keeping them. After install, " |
| 10650 | "re-index to pick up this version's improvements:\n", |
| 10651 | index_count); |
| 10652 | cbm_list_indexes(home); |
| 10653 | printf("\n"); |
| 10654 | return 1; /* proceed without deleting */ |
| 10655 | } |
| 10656 | |
| 10657 | /* Opt-in reset (--reset-indexes): the original prompt-and-delete path. */ |
| 10658 | printf("Found %d existing index(es):\n", index_count); |
| 10659 | cbm_list_indexes(home); |
| 10660 | printf("\n"); |
| 10661 | if (!prompt_yn("Delete these indexes and continue with install?")) { |
| 10662 | printf("Install cancelled.\n"); |
| 10663 | return 0; /* abort */ |
| 10664 | } |
| 10665 | if (!dry_run && delete_indexes_out) { |
| 10666 | *delete_indexes_out = true; |
| 10667 | } |
| 10668 | return 1; /* proceed */ |
| 10669 | } |
| 10670 | |
| 10671 | int cbm_install_handle_existing_indexes(const char *home, bool reset, bool dry_run) { |
| 10672 | bool delete_indexes = false; |
no test coverage detected