-- ============================================================================
-- Copyright (C) 2026 Alles Watt lauft
-- ============================================================================

ALTER TABLE llx_kundenkarte_anlage_type_field ADD UNIQUE INDEX uk_kundenkarte_anlage_type_field (fk_anlage_type, field_code);

ALTER TABLE llx_kundenkarte_anlage_type_field ADD INDEX idx_kundenkarte_anlage_type_field_fk_type (fk_anlage_type);
ALTER TABLE llx_kundenkarte_anlage_type_field ADD INDEX idx_kundenkarte_anlage_type_field_active (active);

ALTER TABLE llx_kundenkarte_anlage_type_field ADD CONSTRAINT fk_kundenkarte_anlage_type_field_fk_type FOREIGN KEY (fk_anlage_type) REFERENCES llx_kundenkarte_anlage_type (rowid) ON DELETE CASCADE;
