## Bug description
Hi, after upgrade from 1.23.1 to 1.24.0 we see in the migration this error
```
django.db.utils.NotSupportedError: cannot create index on partitioned table "posthog_event" concurrently
``` 

We have the events table partitioned using the inbuilt tool and apparently the migration does not handle that well. 

## Environment
Self-hosted instance running in Kubernetes using upstream docker images
posthog/models/event.py
timestamp = self.filter(team_id=team_id).order_by("timestamp").values_list("timestamp", flat=True).first()
        if timestamp is None:
            timestamp = timezone.now() - DEFAULT_EARLIEST_TIME_DELTA
        return timestamp.replace(hour=0, minute=0, second=0, microsecond=0).isoformat()
    def filter_by_element(self, filters: Dict, team_id: int):
        groups = ElementGroup.objects.filter(team_id=team_id)
        filter = Q()
        if filters.get("selector"):
            selector = Selector(filters["selector"])
            subqueries, subq_filter = self._element_subquery(selector)
            filter = Q(**subq_filter)
            groups = groups.annotate(**subqueries)  
        else:
            filter = Q()
        for key in ["tag_name", "text", "href"]:
            values = filters.get(key, [])
            if not values:
                continue
            values = values if isinstance(values, list) else [values]
            if len(values) == 0:
                continue
            condition = Q()
            for searched_value in values:
                condition |= Q(**{"element__{}".format(key): searched_value})
            filter &= condition
        if not filter:
            return {}
        groups = groups.filter(filter)
        return {"elements_hash__in": groups.values_list("hash", flat=True)}
    def filter_by_url(self, action_step: ActionStep, subquery: QuerySet):