File: executor.pyi

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (44 lines) | stat: -rw-r--r-- 1,785 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from collections.abc import Sequence
from typing import Protocol, type_check_only

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.migrations.migration import Migration

from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState

@type_check_only
class _ProgressCallbackT(Protocol):
    def __call__(self, action: str, migration: Migration | None = ..., fake: bool | None = ..., /) -> None: ...

class MigrationExecutor:
    connection: BaseDatabaseWrapper
    loader: MigrationLoader
    recorder: MigrationRecorder
    progress_callback: _ProgressCallbackT | None
    def __init__(
        self,
        connection: BaseDatabaseWrapper | None,
        progress_callback: _ProgressCallbackT | None = None,
    ) -> None: ...
    def migration_plan(
        self, targets: Sequence[tuple[str, str | None]] | set[tuple[str, str]], clean_start: bool = False
    ) -> list[tuple[Migration, bool]]: ...
    def migrate(
        self,
        targets: Sequence[tuple[str, str | None]] | None,
        plan: Sequence[tuple[Migration, bool]] | None = None,
        state: ProjectState | None = None,
        fake: bool = False,
        fake_initial: bool = False,
    ) -> ProjectState: ...
    def apply_migration(
        self, state: ProjectState, migration: Migration, fake: bool = False, fake_initial: bool = False
    ) -> ProjectState: ...
    def record_migration(self, migration: Migration) -> None: ...
    def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = False) -> ProjectState: ...
    def check_replacements(self) -> None: ...
    def detect_soft_applied(
        self, project_state: ProjectState | None, migration: Migration
    ) -> tuple[bool, ProjectState]: ...