# Path: psqlextra/partitioning/config.py
# class PostgresPartitioningConfig:
#     """Configuration for partitioning a specific model according to the
#     specified strategy."""
# 
#     def __init__(
#         self,
#         model: PostgresPartitionedModel,
#         strategy: PostgresPartitioningStrategy,
#     ) -> None:
#         self.model = model
#         self.strategy = strategy
# 
# Path: psqlextra/partitioning/constants.py
# AUTO_PARTITIONED_COMMENT = "psqlextra_auto_partitioned"
# 
# Path: psqlextra/partitioning/partition.py
# class PostgresPartition:
#     """Base class for a PostgreSQL table partition."""
# 
#     @abstractmethod
#     def name(self) -> str:
#         """Generates/computes the name for this partition."""
# 
#     @abstractmethod
#     def create(
#         self,
#         model: PostgresPartitionedModel,
#         schema_editor: PostgresSchemaEditor,
#         comment: Optional[str] = None,
#     ) -> None:
#         """Creates this partition in the database."""
# 
#     @abstractmethod
#     def delete(
#         self,
#         model: PostgresPartitionedModel,
#         schema_editor: PostgresSchemaEditor,
#     ) -> None:
#         """Deletes this partition from the database."""
# 
#     def deconstruct(self) -> dict:
#         """Deconstructs this partition into a dict of attributes/fields."""
# 
#         return {"name": self.name()}


from dataclasses import dataclass, field
from typing import List, Optional
from django.db import connections, transaction
from .config import PostgresPartitioningConfig
from .constants import AUTO_PARTITIONED_COMMENT
from .partition import PostgresPartition
                        schema_editor,
                        comment=AUTO_PARTITIONED_COMMENT,
                    )

                for partition in self.deletions:
                    partition.delete(self.config.model, schema_editor)

    def print(self) -> None:
        """Prints this model plan to the terminal in a readable format."""

        print(f"{self.config.model.__name__}:")

        for partition in self.deletions:
            print("  - %s" % partition.name())
            for key, value in partition.deconstruct().items():
                print(f"     {key}: {value}")

        for partition in self.creations:
            print("  + %s" % partition.name())
            for key, value in partition.deconstruct().items():
                print(f"     {key}: {value}")


@dataclass
class PostgresPartitioningPlan:
    """Describes the partitions that are going to be created/deleted."""

    model_plans: List[PostgresModelPartitioningPlan]

    @property

# Path: psqlextra/partitioning/config.py
# class PostgresPartitioningConfig:
#     """Configuration for partitioning a specific model according to the
#     specified strategy."""
# 
#     def __init__(
#         self,
#         model: PostgresPartitionedModel,
#         strategy: PostgresPartitioningStrategy,
#     ) -> None:
#         self.model = model
#         self.strategy = strategy
# 
# Path: psqlextra/partitioning/constants.py
# AUTO_PARTITIONED_COMMENT = "psqlextra_auto_partitioned"
# 
# Path: psqlextra/partitioning/partition.py
# class PostgresPartition:
#     """Base class for a PostgreSQL table partition."""
# 
#     @abstractmethod
#     def name(self) -> str:
#         """Generates/computes the name for this partition."""
# 
#     @abstractmethod
#     def create(
#         self,
#         model: PostgresPartitionedModel,
#         schema_editor: PostgresSchemaEditor,
#         comment: Optional[str] = None,
#     ) -> None:
#         """Creates this partition in the database."""
# 
#     @abstractmethod
#     def delete(
#         self,
#         model: PostgresPartitionedModel,
#         schema_editor: PostgresSchemaEditor,
#     ) -> None:
#         """Deletes this partition from the database."""
# 
#     def deconstruct(self) -> dict:
#         """Deconstructs this partition into a dict of attributes/fields."""
# 
#         return {"name": self.name()}


# Path: psqlextra/partitioning/plan.py
from dataclasses import dataclass, field
from typing import List, Optional
from django.db import connections, transaction
from .config import PostgresPartitioningConfig
from .constants import AUTO_PARTITIONED_COMMENT
from .partition import PostgresPartition

                        schema_editor,
                        comment=AUTO_PARTITIONED_COMMENT,
                    )

                for partition in self.deletions:
                    partition.delete(self.config.model, schema_editor)

    def print(self) -> None:
        """Prints this model plan to the terminal in a readable format."""

        print(f"{self.config.model.__name__}:")

        for partition in self.deletions:
            print("  - %s" % partition.name())
            for key, value in partition.deconstruct().items():
                print(f"     {key}: {value}")

        for partition in self.creations:
            print("  + %s" % partition.name())
            for key, value in partition.deconstruct().items():
                print(f"     {key}: {value}")


@dataclass
class PostgresPartitioningPlan:
    """Describes the partitions that are going to be created/deleted."""

    model_plans: List[PostgresModelPartitioningPlan]

    @property

    def creations(self) -> List[PostgresPartition]: