# Path: psqlextra/backend/migrations/state/materialized_view.py
# class PostgresMaterializedViewModelState(PostgresViewModelState):
#     """Represents the state of a :see:PostgresMaterializedViewModel in the
#     migrations."""
# 
#     @classmethod
#     def _get_base_model_class(self) -> Type[PostgresMaterializedViewModel]:
#         """Gets the class to use as a base class for rendered models."""
# 
#         return PostgresMaterializedViewModel


from django.db.migrations.operations.models import CreateModel
from psqlextra.backend.migrations.state import (
    PostgresMaterializedViewModelState,
)



class PostgresCreateMaterializedViewModel(CreateModel):
    """Creates the model as a native PostgreSQL 11.x materialzed view."""

    serialization_expand_args = [
        "fields",
        "options",
        "managers",
        "view_options",
    ]

    def __init__(
        self,
        name,
        fields,
        options=None,
        view_options={},
        bases=None,
        managers=None,
    ):
        super().__init__(name, fields, options, bases, managers)

        self.view_options = view_options or {}

    def state_forwards(self, app_label, state):
        state.add_model(

# Path: psqlextra/backend/migrations/state/materialized_view.py
# class PostgresMaterializedViewModelState(PostgresViewModelState):
#     """Represents the state of a :see:PostgresMaterializedViewModel in the
#     migrations."""
# 
#     @classmethod
#     def _get_base_model_class(self) -> Type[PostgresMaterializedViewModel]:
#         """Gets the class to use as a base class for rendered models."""
# 
#         return PostgresMaterializedViewModel


# Path: psqlextra/backend/migrations/operations/create_materialized_view_model.py
from django.db.migrations.operations.models import CreateModel
from psqlextra.backend.migrations.state import (
    PostgresMaterializedViewModelState,
)




class PostgresCreateMaterializedViewModel(CreateModel):
    """Creates the model as a native PostgreSQL 11.x materialzed view."""

    serialization_expand_args = [
        "fields",
        "options",
        "managers",
        "view_options",
    ]

    def __init__(
        self,
        name,
        fields,
        options=None,
        view_options={},
        bases=None,
        managers=None,
    ):
        super().__init__(name, fields, options, bases, managers)

        self.view_options = view_options or {}

    def state_forwards(self, app_label, state):
        state.add_model(

            PostgresMaterializedViewModelState(