from __future__ import print_function import logging from django.core.management import CommandError from django_elastic_migrations import DEMIndexManager from django_elastic_migrations.exceptions import CannotDropAllIndexesWithoutForceArg from django_elastic_migrations.management.commands.es import ESCommand from django_elastic_migrations.utils.django_elastic_migrations_log import get_logger logger = get_logger() class Command(ESCommand): help = "django-elastic-migrations: drop indexes" def add_arguments(self, parser): self.get_index_specifying_arguments(parser, include_older=True) parser.add_argument( '--es-only', action='store_true', help=("Drop indexes in elasticsearch " "without updating DEM's IndexVersion ORM model (!)")) parser.add_argument( '--force', action='store_true', help="Drop indexes without having to specify the index version ") parser.add_argument( '--just-prefix', nargs='?', help=("Only drop index versions whose name begins with " "the given environment prefix"))
from typing import NamedTuple from texttable import Texttable from django_elastic_migrations import DEMIndexManager from django_elastic_migrations.exceptions import FirstMigrationNotRunError from django_elastic_migrations.management.commands.es import ESCommand from django_elastic_migrations.utils.django_elastic_migrations_log import get_logger log = get_logger() """ Data model for making a row of the output table from ./manage.py es_list """ EsListRow = NamedTuple('EsListRow', [ ('index_base_name', str), ('index_version_name', str), ('created', int), ('active', int), ('docs', int), ('tag', str), ]) class Command(ESCommand): help = "django-elastic-migrations: list available indexes" def add_arguments(self, parser): self.get_index_specifying_arguments(parser, include_exact=False, default_all=True) parser.add_argument(