-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from fecgov/boolean-migrate-hotfix
Boolean migrate hotfix
- Loading branch information
Showing
4 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
cd django-backend | ||
|
||
# Run migrations | ||
./manage.py migrate --noinput | ||
./manage.py migrate --noinput > migrate.out | ||
|
||
# Run application | ||
python wait_for_db.py && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 -t 200 |
23 changes: 18 additions & 5 deletions
23
django-backend/fecfiler/f3x_summaries/migrations/0009_auto_20220515_2116.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
# Generated by Django 3.2.12 on 2022-05-16 01:16 | ||
|
||
from fecfiler.f3x_summaries.models import F3XSummary | ||
from django.db import migrations, models | ||
|
||
|
||
def convert_fecfile_booleans(apps, schema_editor): | ||
for f3x_summary in F3XSummary.objects.all(): | ||
f3x_summary.change_of_address = ( | ||
True if f3x_summary.change_of_address in ["true", "X"] else False | ||
) | ||
f3x_summary.qualified_committee = ( | ||
True if f3x_summary.qualified_committee in ["true", "X"] else False | ||
) | ||
f3x_summary.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('f3x_summaries', '0008_auto_20220503_1411'), | ||
("f3x_summaries", "0008_auto_20220503_1411"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(convert_fecfile_booleans), | ||
migrations.AlterField( | ||
model_name='f3xsummary', | ||
name='change_of_address', | ||
model_name="f3xsummary", | ||
name="change_of_address", | ||
field=models.BooleanField(blank=True, default=False, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='f3xsummary', | ||
name='qualified_committee', | ||
model_name="f3xsummary", | ||
name="qualified_committee", | ||
field=models.BooleanField(blank=True, default=False, null=True), | ||
), | ||
] |
16 changes: 13 additions & 3 deletions
16
django-backend/fecfiler/scha_transactions/migrations/0008_alter_schatransaction_memo_code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
# Generated by Django 3.2.12 on 2022-05-16 11:44 | ||
|
||
from django.db import migrations, models | ||
from fecfiler.scha_transactions.models import SchATransaction | ||
|
||
|
||
def convert_fecfile_booleans(apps, schema_editor): | ||
for transaction in SchATransaction.objects.all(): | ||
transaction.memo_code = ( | ||
True if transaction.memo_code in ["true", "X"] else False | ||
) | ||
transaction.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scha_transactions', '0007_alter_schatransaction_committee_account'), | ||
("scha_transactions", "0007_alter_schatransaction_committee_account"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(convert_fecfile_booleans), | ||
migrations.AlterField( | ||
model_name='schatransaction', | ||
name='memo_code', | ||
model_name="schatransaction", | ||
name="memo_code", | ||
field=models.BooleanField(blank=True, default=False, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters