ALTER TABLE assets ADD COLUMN hypervisor_asset_id uuid, ADD CONSTRAINT assets_hypervisor_not_self CHECK (hypervisor_asset_id <> asset_id), ADD CONSTRAINT assets_same_customer_hypervisor FOREIGN KEY (tenant_id, hypervisor_asset_id) REFERENCES assets(tenant_id, asset_id) ON DELETE SET NULL (hypervisor_asset_id); CREATE INDEX assets_hypervisor_reference ON assets (tenant_id, hypervisor_asset_id) WHERE hypervisor_asset_id IS NOT NULL; GRANT UPDATE (hypervisor_asset_id) ON assets TO rmm_app;