Skip to content

Create code that duplicates instance integration creation into 2 tables

As part of &14638 we need to start using new instance_integrations model in order to migrate instance wide integrations from integrations to instance_integrations table.

As part of the transition, whenever instance_integrations table and InstanceIntegration model becomes available, we need to start duplicating instance wide integrations created by a user, so that an integration record appears in both tables.

Proposed solution

  1. Whenever user creates instance integrations, add an after_save hook to create an identical InstanceIntegration record, so that it can be used later on once we switch to using InstanceIntegration model.
  2. Additionally, add after_update hook to update instance_integration record if integration record gets updated, to cover a scenario where a new integration is created & gets updated afterwards.

Alternatively, it was suggested in !162552 (closed) to use PostgresQL Trigger to populate instance_integrations table.

Edited by George Koltsov