From 6bac3fc9c21d2fad1e18e603b4642346d536a601 Mon Sep 17 00:00:00 2001 From: littlewolf Date: Sat, 16 Nov 2019 14:58:22 +0300 Subject: [PATCH] Add fields --- .../migrations/0028_merge_20191115_1302.py | 14 +++++++++ .../migrations/0029_merge_20191116_1132.py | 14 +++++++++ .../migrations/0030_auto_20191116_1151.py | 29 +++++++++++++++++++ apps/location/models.py | 7 +++++ 4 files changed, 64 insertions(+) create mode 100644 apps/location/migrations/0028_merge_20191115_1302.py create mode 100644 apps/location/migrations/0029_merge_20191116_1132.py create mode 100644 apps/location/migrations/0030_auto_20191116_1151.py diff --git a/apps/location/migrations/0028_merge_20191115_1302.py b/apps/location/migrations/0028_merge_20191115_1302.py new file mode 100644 index 00000000..d1f75d78 --- /dev/null +++ b/apps/location/migrations/0028_merge_20191115_1302.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.7 on 2019-11-15 13:02 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('location', '0027_auto_20191110_1331'), + ('location', '0023_auto_20191112_0104'), + ] + + operations = [ + ] diff --git a/apps/location/migrations/0029_merge_20191116_1132.py b/apps/location/migrations/0029_merge_20191116_1132.py new file mode 100644 index 00000000..02c44c18 --- /dev/null +++ b/apps/location/migrations/0029_merge_20191116_1132.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.7 on 2019-11-16 11:32 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('location', '0028_merge_20191115_1302'), + ('location', '0026_country_is_active'), + ] + + operations = [ + ] diff --git a/apps/location/migrations/0030_auto_20191116_1151.py b/apps/location/migrations/0030_auto_20191116_1151.py new file mode 100644 index 00000000..76a6012b --- /dev/null +++ b/apps/location/migrations/0030_auto_20191116_1151.py @@ -0,0 +1,29 @@ +# Generated by Django 2.2.7 on 2019-11-16 11:51 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('location', '0029_merge_20191116_1132'), + ] + + operations = [ + migrations.AddField( + model_name='city', + name='mysql_ids', + field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), + ), + migrations.AddField( + model_name='country', + name='mysql_ids', + field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), + ), + migrations.AddField( + model_name='region', + name='mysql_ids', + field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), blank=True, null=True, size=None), + ), + ] diff --git a/apps/location/models.py b/apps/location/models.py index d5d4ef3d..795b2670 100644 --- a/apps/location/models.py +++ b/apps/location/models.py @@ -6,6 +6,8 @@ from django.db.transaction import on_commit from django.dispatch import receiver from django.utils.translation import gettext_lazy as _ +from django.contrib.postgres.fields import ArrayField + from translation.models import Language from utils.models import (ProjectBaseMixin, SVGImageMixin, TJSONField, TranslatedFieldsMixin, get_current_locale) @@ -39,6 +41,8 @@ class Country(TranslatedFieldsMixin, SVGImageMixin, ProjectBaseMixin): is_active = models.BooleanField(_('is active'), default=True) old_id = models.IntegerField(null=True, blank=True, default=None) + mysql_ids = ArrayField(models.IntegerField(), blank=True, null=True) + objects = CountryQuerySet.as_manager() @property @@ -77,6 +81,7 @@ class Region(models.Model): country = models.ForeignKey( Country, verbose_name=_('country'), on_delete=models.CASCADE) old_id = models.IntegerField(null=True, blank=True, default=None) + mysql_ids = ArrayField(models.IntegerField(), blank=True, null=True) class Meta: """Meta class.""" @@ -121,6 +126,8 @@ class City(models.Model): gallery = models.ManyToManyField('gallery.Image', through='location.CityGallery', blank=True) + mysql_ids = ArrayField(models.IntegerField(), blank=True, null=True) + objects = CityQuerySet.as_manager() class Meta: