You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
724 B
19 lines
724 B
from django.core.management.base import BaseCommand
|
|
from service.utils import run_sql_command, log_to_telegram
|
|
|
|
CMD_PIVOT_DIST = """DROP MATERIALIZED VIEW IF EXISTS public.points_with_dist;"""
|
|
|
|
CMD_PIVOT_DIST_PRE = """DROP MATERIALIZED VIEW IF EXISTS public.prepoints_with_dist;"""
|
|
class Command(BaseCommand):
|
|
help = 'delete views'
|
|
|
|
def handle(self, *args, **kwargs):
|
|
try:
|
|
log_to_telegram('Deleting views')
|
|
run_sql_command(CMD_PIVOT_DIST)
|
|
log_to_telegram('pivot_dist deleted')
|
|
run_sql_command(CMD_PIVOT_DIST_PRE)
|
|
log_to_telegram('prepivot_dist deleted')
|
|
except Exception as e:
|
|
log_to_telegram('Error deleting views: ' + str(e))
|