diff --git a/src/hct_mis_api/apps/household/migrations/0188_migration.py b/src/hct_mis_api/apps/household/migrations/0188_migration.py new file mode 100644 index 0000000000..d0028206ad --- /dev/null +++ b/src/hct_mis_api/apps/household/migrations/0188_migration.py @@ -0,0 +1,52 @@ +# Generated by Django 3.2.25 on 2024-11-05 17:49 +from django.contrib.postgres.operations import AddIndexConcurrently +from django.db import migrations, models + + +class Migration(migrations.Migration): + atomic = False + + dependencies = [ + ('household', '0187_migration'), + ] + + operations = [ + migrations.RemoveField( + model_name='bankaccountinfo', + name='is_migration_handled', + ), + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name='bankaccountinfo', + name='bank_account_number', + field=models.CharField(db_index=True, max_length=64), + ), + ], + database_operations=[ + AddIndexConcurrently( + model_name="bankaccountinfo", + index=models.Index( + fields=["bank_account_number"], name="bank_account_number_idx" + ) + ), + ] + ), + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name='bankaccountinfo', + name='debit_card_number', + field=models.CharField(blank=True, db_index=True, default='', max_length=255), + ), + ], + database_operations=[ + AddIndexConcurrently( + model_name="bankaccountinfo", + index=models.Index( + fields=["debit_card_number"], name="debit_card_number_idx" + ) + ), + ] + ) + ] diff --git a/src/hct_mis_api/apps/household/models.py b/src/hct_mis_api/apps/household/models.py index 4fb4d04b8e..0e1f0feee7 100644 --- a/src/hct_mis_api/apps/household/models.py +++ b/src/hct_mis_api/apps/household/models.py @@ -1316,11 +1316,10 @@ class BankAccountInfo(SoftDeletableRepresentationMergeStatusModelWithDate, TimeS on_delete=models.CASCADE, ) bank_name = models.CharField(max_length=255) - bank_account_number = models.CharField(max_length=64) - debit_card_number = models.CharField(max_length=255, blank=True, default="") + bank_account_number = models.CharField(max_length=64, db_index=True) + debit_card_number = models.CharField(max_length=255, blank=True, default="", db_index=True) bank_branch_name = models.CharField(max_length=255, blank=True, default="") account_holder_name = models.CharField(max_length=255, blank=True, default="") - is_migration_handled = models.BooleanField(default=False) copied_from = models.ForeignKey( "self", null=True,