Skip to content

Commit

Permalink
fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed May 17, 2024
1 parent 1f16d64 commit 69f75d1
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions peachjam/migrations/0132_outcome_es_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ def forwards(apps, schema_editor):
from django.conf import settings
from django_elasticsearch_dsl.registries import registry

# if not settings.DEBUG and os.environ.get("ELASTICSEARCH_HOST"):
for ix in registry.get_indices():
if not ix._mapping:
continue
print(f"Adding outcome mapping for {ix._name}")
ix.connection.indices.put_mapping(
index=ix._name,
body={
"properties": {
"outcome": ix._mapping["outcome"].to_dict(),
"outcome_en": ix._mapping["outcome_en"].to_dict(),
"outcome_sw": ix._mapping["outcome_sw"].to_dict(),
"outcome_fr": ix._mapping["outcome_fr"].to_dict(),
"outcome_pt": ix._mapping["outcome_pt"].to_dict(),
}
},
)
if not settings.DEBUG and os.environ.get("ELASTICSEARCH_HOST"):
for ix in registry.get_indices():
if not ix._mapping:
continue
print(f"Adding outcome mapping for {ix._name}")
ix.connection.indices.put_mapping(
index=ix._name,
body={
"properties": {
"outcome": ix._mapping["outcome"].to_dict(),
"outcome_en": ix._mapping["outcome_en"].to_dict(),
"outcome_sw": ix._mapping["outcome_sw"].to_dict(),
"outcome_fr": ix._mapping["outcome_fr"].to_dict(),
"outcome_pt": ix._mapping["outcome_pt"].to_dict(),
}
},
)


class Migration(migrations.Migration):
Expand Down

0 comments on commit 69f75d1

Please sign in to comment.