diff --git a/bothub/common/migrations/0028_auto_20190121_1250.py b/bothub/common/migrations/0028_auto_20190121_1250.py index 4c076130a..1491eed01 100644 --- a/bothub/common/migrations/0028_auto_20190121_1250.py +++ b/bothub/common/migrations/0028_auto_20190121_1250.py @@ -3,21 +3,6 @@ from django.db import migrations, models -def populate_algorithm(apps, *args): - from bothub.common.models import Repository as R - Repository = apps.get_model('common', 'Repository') - for repository in Repository.objects.all(): - repository.algorithm = R.ALGORITHM_NEURAL_NETWORK_EXTERNAL \ - if repository.use_language_model_featurizer else \ - R.ALGORITHM_NEURAL_NETWORK_INTERNAL - repository.save(update_fields=['algorithm']) - for update in repository.updates.all(): - update.algorithm = R.ALGORITHM_NEURAL_NETWORK_EXTERNAL \ - if update.use_language_model_featurizer else \ - R.ALGORITHM_NEURAL_NETWORK_INTERNAL - update.save(update_fields=['algorithm']) - - class Migration(migrations.Migration): dependencies = [ @@ -35,13 +20,4 @@ class Migration(migrations.Migration): name='algorithm', field=models.CharField(choices=[('statistical_model', 'Statistical Model'), ('neural_network_internal', 'Neural Network with internal vocabulary'), ('neural_network_external', 'Neural Network with external vocabulary (BETA)')], default='statistical_model', max_length=24, verbose_name='algorithm'), ), - migrations.RunPython(populate_algorithm), - migrations.RemoveField( - model_name='repository', - name='use_language_model_featurizer', - ), - migrations.RemoveField( - model_name='repositoryupdate', - name='use_language_model_featurizer', - ), ] diff --git a/bothub/common/migrations/0029_auto_20190126_0247.py b/bothub/common/migrations/0029_auto_20190126_0247.py new file mode 100644 index 000000000..9694731d5 --- /dev/null +++ b/bothub/common/migrations/0029_auto_20190126_0247.py @@ -0,0 +1,38 @@ +# Generated by Django 2.1.5 on 2019-01-26 02:47 + +from django.db import migrations + + +def populate_algorithm(apps, *args): + from bothub.common.models import Repository as R + Repository = apps.get_model('common', 'Repository') + for repository in Repository.objects.all(): + repository.algorithm = R.ALGORITHM_NEURAL_NETWORK_EXTERNAL \ + if repository.use_language_model_featurizer else \ + R.ALGORITHM_NEURAL_NETWORK_INTERNAL + repository.save(update_fields=['algorithm']) + for update in repository.updates.all(): + update.algorithm = R.ALGORITHM_NEURAL_NETWORK_EXTERNAL \ + if update.use_language_model_featurizer else \ + R.ALGORITHM_NEURAL_NETWORK_INTERNAL + update.save(update_fields=['algorithm']) + + +class Migration(migrations.Migration): + + dependencies = [ + ('common', '0028_auto_20190121_1250'), + ] + + operations = [ + migrations.RunPython(populate_algorithm), + migrations.RemoveField( + model_name='repository', + name='use_language_model_featurizer', + ), + migrations.RemoveField( + model_name='repositoryupdate', + name='use_language_model_featurizer', + ), + ] +