Closed louiseGrandjonc closed 4 years ago
Here is what happens.
When dropping a model, the default migration drops foreign key constraints. And is executed in a single transaction:
SET CONSTRAINTS "my_fk_constraint" IMMEDIATE; ALTER TABLE "my_table" DROP CONSTRAINT "my_fk_constraint"
On the shards are executed
SELECT worker_apply_shard_ddl_command (102259, 'public', 'SET CONSTRAINTS "my_fk_constraint" IMMEDIATE; ALTER TABLE "my_table" DROP CONSTRAINT "my_fk_constraint"')
This fails with the error cannot execute multiple utility events
cannot execute multiple utility events
In the django it comes from https://github.com/django/django/blob/master/django/db/backends/postgresql/schema.py#L21
In the backend, it would be great to avoid that.
The goal is for customer to be able to use auto-generated migrations to drop models.
Test with citus 8.3
Fixed since https://github.com/citusdata/django-multitenant/pull/50/files
Here is what happens.
When dropping a model, the default migration drops foreign key constraints. And is executed in a single transaction:
SET CONSTRAINTS "my_fk_constraint" IMMEDIATE; ALTER TABLE "my_table" DROP CONSTRAINT "my_fk_constraint"
On the shards are executed
SELECT worker_apply_shard_ddl_command (102259, 'public', 'SET CONSTRAINTS "my_fk_constraint" IMMEDIATE; ALTER TABLE "my_table" DROP CONSTRAINT "my_fk_constraint"')
This fails with the error
cannot execute multiple utility events
In the django it comes from
https://github.com/django/django/blob/master/django/db/backends/postgresql/schema.py#L21
In the backend, it would be great to avoid that.
The goal is for customer to be able to use auto-generated migrations to drop models.