<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations

# language=SQL
CREATE_SQL = """
DROP INDEX msgs_msg_org_failed_created_on;

CREATE INDEX msgs_msg_outbox_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status IN ('P', 'Q');

CREATE INDEX msgs_msg_sent_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status IN ('W', 'S', 'D');

CREATE INDEX msgs_msg_failed_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status = 'F';
"""
<commit_msg>drop indexes first so creation always works<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations

# language=SQL
CREATE_SQL = """
DROP INDEX IF EXISTS msgs_msg_org_failed_created_on;
DROP INDEX IF EXISTS msgs_msg_sent_label;
DROP INDEX IF EXISTS msgs_msg_outbox_label;
DROP INDEX IF EXISTS msgs_msg_failed_label;

CREATE INDEX msgs_msg_outbox_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status IN ('P', 'Q');

CREATE INDEX msgs_msg_sent_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status IN ('W', 'S', 'D');

CREATE INDEX msgs_msg_failed_label ON msgs_msg(org_id, created_on DESC)
WHERE direction = 'O' AND visibility = 'V' AND status = 'F';
"""

{'fraction_non_alphanumeric': 0.10478199718706048, 'fraction_numerical': 0.0014064697609001407, 'mean_word_length': 5.776190476190476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7387251', 'n_tokens_mistral': 517, 'n_tokens_neox': 505, 'n_words': 161}