def create_initial_version(
        cls, environment: "Environment", feature: "Feature"
    ) -> "EnvironmentFeatureVersion":
        """
        Create an initial version with all the current feature states
        for a feature / environment combination.
        """

        if not environment.use_v2_feature_versioning:
            raise FeatureVersioningError(
                "Cannot create initial version for environment using v1 versioning."
            )
        elif cls.objects.filter(environment=environment, feature=feature).exists():
            raise FeatureVersioningError(
                "Version already exists for this feature / environment combination."
            )

        return cls.objects.create(  # type: ignore[no-any-return]
            environment=environment, feature=feature, published_at=timezone.now()
        )

        Create an initial version with all the current feature states
        for a feature / environment combination.
        
api/features/versioning/models.py