# Path: psqlextra/backend/migrations/state/partitioning.py
# class PostgresRangePartitionState(PostgresPartitionState):
#     """Represents the state of a range partition for a
#     :see:PostgresPartitionedModel during a migration."""
# 
#     def __init__(
#         self, app_label: str, model_name: str, name: str, from_values, to_values
#     ):
#         super().__init__(app_label, model_name, name)
# 
#         self.from_values = from_values
#         self.to_values = to_values
# 
# 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 PostgresRangePartitionState
from .partition import PostgresPartitionOperation

    def __init__(self, model_name: str, name: str, from_values, to_values):
        """Initializes new instance of :see:AddRangePartition.

        Arguments:
            model_name:
                The name of the :see:PartitionedPostgresModel.

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

            from_values:
                Start of the partitioning key range of
                values that need to be stored in this
                partition.

            to_values:
                End of the partitioning key range of
                values that need to be stored in this
                partition.
        """

        super().__init__(model_name, name)

        self.from_values = from_values
        self.to_values = to_values

    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 PostgresRangePartitionState(PostgresPartitionState):
#     """Represents the state of a range partition for a
#     :see:PostgresPartitionedModel during a migration."""
# 
#     def __init__(
#         self, app_label: str, model_name: str, name: str, from_values, to_values
#     ):
#         super().__init__(app_label, model_name, name)
# 
#         self.from_values = from_values
#         self.to_values = to_values
# 
# 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_range_partition.py
from psqlextra.backend.migrations.state import PostgresRangePartitionState
from .partition import PostgresPartitionOperation


    def __init__(self, model_name: str, name: str, from_values, to_values):
        """Initializes new instance of :see:AddRangePartition.

        Arguments:
            model_name:
                The name of the :see:PartitionedPostgresModel.

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

            from_values:
                Start of the partitioning key range of
                values that need to be stored in this
                partition.

            to_values:
                End of the partitioning key range of
                values that need to be stored in this
                partition.
        """

        super().__init__(model_name, name)

        self.from_values = from_values
        self.to_values = to_values

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

            PostgresRangePartitionState(