# Path: psqlextra/backend/migrations/state/partitioning.py
# class PostgresHashPartitionState(PostgresPartitionState):
#     """Represents the state of a hash partition for a
#     :see:PostgresPartitionedModel during a migration."""
# 
#     def __init__(
#         self,
#         app_label: str,
#         model_name: str,
#         name: str,
#         modulus: int,
#         remainder: int,
#     ):
#         super().__init__(app_label, model_name, name)
# 
#         self.modulus = modulus
#         self.remainder = remainder
# 
# Path: psqlextra/backend/migrations/operations/partition.py
# class PostgresPartitionOperation(Operation):
#     def __init__(self, model_name: str, name: str) -> None:
#         """Initializes new instance of :see:AddDefaultPartition.
# 
#         Arguments:
#             model_name:
#                 The name of the :see:PartitionedPostgresModel.
# 
#             name:
#                 The name to give to the new partition table.
#         """
# 
#         self.model_name = model_name
#         self.model_name_lower = model_name.lower()
#         self.name = name
# 
#     def deconstruct(self):
#         kwargs = {"model_name": self.model_name, "name": self.name}
#         return (self.__class__.__qualname__, [], kwargs)
# 
#     def state_forwards(self, *args, **kwargs):
#         pass
# 
#     def state_backwards(self, *args, **kwargs):
#         pass
# 
#     def reduce(self, *args, **kwargs):
#         # PartitionOperation doesn't break migrations optimizations
#         return True


from psqlextra.backend.migrations.state import PostgresHashPartitionState
from .partition import PostgresPartitionOperation
    partition key divided by the specified modulus will produce the
    specified remainder.
    """

    def __init__(
        self, model_name: str, name: str, modulus: int, remainder: int
    ):
        """Initializes new instance of :see:AddHashPartition.
        Arguments:
            model_name:
                The name of the :see:PartitionedPostgresModel.

            name:
                The name to give to the new partition table.

            modulus:
                Integer value by which the key is divided.

            remainder:
                The remainder of the hash value when divided by modulus.
        """

        super().__init__(model_name, name)

        self.modulus = modulus
        self.remainder = remainder

    def state_forwards(self, app_label, state):
        model = state.models[(app_label, self.model_name_lower)]
        model.add_partition(

# Path: psqlextra/backend/migrations/state/partitioning.py
# class PostgresHashPartitionState(PostgresPartitionState):
#     """Represents the state of a hash partition for a
#     :see:PostgresPartitionedModel during a migration."""
# 
#     def __init__(
#         self,
#         app_label: str,
#         model_name: str,
#         name: str,
#         modulus: int,
#         remainder: int,
#     ):
#         super().__init__(app_label, model_name, name)
# 
#         self.modulus = modulus
#         self.remainder = remainder
# 
# Path: psqlextra/backend/migrations/operations/partition.py
# class PostgresPartitionOperation(Operation):
#     def __init__(self, model_name: str, name: str) -> None:
#         """Initializes new instance of :see:AddDefaultPartition.
# 
#         Arguments:
#             model_name:
#                 The name of the :see:PartitionedPostgresModel.
# 
#             name:
#                 The name to give to the new partition table.
#         """
# 
#         self.model_name = model_name
#         self.model_name_lower = model_name.lower()
#         self.name = name
# 
#     def deconstruct(self):
#         kwargs = {"model_name": self.model_name, "name": self.name}
#         return (self.__class__.__qualname__, [], kwargs)
# 
#     def state_forwards(self, *args, **kwargs):
#         pass
# 
#     def state_backwards(self, *args, **kwargs):
#         pass
# 
#     def reduce(self, *args, **kwargs):
#         # PartitionOperation doesn't break migrations optimizations
#         return True


# Path: psqlextra/backend/migrations/operations/add_hash_partition.py
from psqlextra.backend.migrations.state import PostgresHashPartitionState
from .partition import PostgresPartitionOperation

    partition key divided by the specified modulus will produce the
    specified remainder.
    """

    def __init__(
        self, model_name: str, name: str, modulus: int, remainder: int
    ):
        """Initializes new instance of :see:AddHashPartition.
        Arguments:
            model_name:
                The name of the :see:PartitionedPostgresModel.

            name:
                The name to give to the new partition table.

            modulus:
                Integer value by which the key is divided.

            remainder:
                The remainder of the hash value when divided by modulus.
        """

        super().__init__(model_name, name)

        self.modulus = modulus
        self.remainder = remainder

    def state_forwards(self, app_label, state):
        model = state.models[(app_label, self.model_name_lower)]
        model.add_partition(

            PostgresHashPartitionState(