Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (watchdogpolska#968)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 21.5b1 → 21.5b2](psf/black@21.5b1...21.5b2)
- [github.com/asottile/pyupgrade: v2.16.0 → v2.19.0](asottile/pyupgrade@v2.16.0...v2.19.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored May 31, 2021
1 parent 4b27126 commit 6a5d7e1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/psf/black
rev: 21.5b1
rev: 21.5b2
hooks:
- id: black
pass_filenames: true
Expand Down Expand Up @@ -31,7 +31,7 @@ repos:
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/asottile/pyupgrade
rev: v2.16.0
rev: v2.19.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
Expand Down
2 changes: 1 addition & 1 deletion backend-project/contrib/github/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ docker-compose run backend python -W ignore manage.py generate_swagger -f yaml >
docker-compose run backend python -W ignore manage.py generate_swagger -f json > openapi.json

# Verify successfull migration of data
docker-compose run --rm backend python manage.py migrate_v1
docker-compose run --rm backend python manage.py migrate_v1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json

from django.core.management.base import BaseCommand
from django.conf import settings
from django.core.management.base import BaseCommand

from ....files.models import File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.core.management.base import BaseCommand

from ...migrator import run, logger
from ...migrator import logger, run


class Command(BaseCommand):
Expand Down
16 changes: 8 additions & 8 deletions backend-project/small_eod/migration_v1/migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
from datetime import datetime
from uuid import uuid4

from pytz import timezone
from django.contrib.auth import get_user_model
from django.db import transaction
from pytz import timezone

from . import models as models_v1
from ..tags.models import Tag
from ..institutions.models import Institution
from ..cases.models import Case
from ..features.models import Feature, FeatureOption
from ..channels.models import Channel
from ..letters.models import DocumentType, Letter
from ..features.models import Feature, FeatureOption
from ..files.models import File
from ..institutions.models import Institution
from ..letters.models import DocumentType, Letter
from ..tags.models import Tag
from . import models as models_v1

logger = logging.getLogger(__name__)
MIGRATION_DB = "migration"
V2_DB = "default"


class PkMappings:
""" Cache old_pk -> new_pk mapping when it is inconvenient to make a query """
"""Cache old_pk -> new_pk mapping when it is inconvenient to make a query"""

institution = dict()
case = dict()
user = dict()


def fix_timestamps(new, old):
""" Migrate data to auto-filling timestamp fields """
"""Migrate data to auto-filling timestamp fields"""
model = type(new)
# Queryset update will ignore auto_now/auto_now_add
model.objects.filter(pk=new.pk).update(
Expand Down
2 changes: 1 addition & 1 deletion backend-project/small_eod/migration_v1/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
from model_utils import Choices
from model_utils.models import TimeStampedModel
from django.utils.translation import gettext_lazy as _


class Dictionary(TimeStampedModel):
Expand Down

0 comments on commit 6a5d7e1

Please sign in to comment.