         DELETE FROM AM_API_RATINGS AMAR WHERE AMAR.API_ID = :OLD.API_ID;
         DELETE FROM AM_EXTERNAL_STORES AMES WHERE AMES.API_ID = :OLD.API_ID;
         DELETE FROM AM_API_SCOPES AMS WHERE AMS.API_ID = :OLD.API_ID;
-	DELETE FROM AM_API_PRODUCT_MAPPING AAPM WHERE AAPM.API_ID = :OLD.API_ID;
-	DELETE FROM AM_API_CLIENT_CERTIFICATE AACC WHERE AACC.API_ID = :OLD.API_ID;
-	DELETE FROM AM_SECURITY_AUDIT_UUID_MAPPING ASAUM WHERE ASAUM.API_ID = :OLD.API_ID;
+        DELETE FROM AM_API_PRODUCT_MAPPING AAPM WHERE AAPM.API_ID = :OLD.API_ID;
+        DELETE FROM AM_API_CLIENT_CERTIFICATE AACC WHERE AACC.API_ID = :OLD.API_ID;
+        DELETE FROM AM_SECURITY_AUDIT_UUID_MAPPING ASAUM WHERE ASAUM.API_ID = :OLD.API_ID;
+        DELETE FROM AM_GRAPHQL_COMPLEXITY AGC WHERE AGC.API_ID = :OLD.API_ID;
       END;
 /
 CREATE OR REPLACE TRIGGER TRG_DEL_AM_API_URL_MAPPING


--TODO: Have to add ON UPDATE CASCADE for the FOREIGN KEY(APPLICATION_ID) relation
CREATE TABLE AM_APPLICATION_KEY_MAPPING (
    UUID VARCHAR2(512),
    APPLICATION_ID INTEGER,
    CONSUMER_KEY VARCHAR2(512),
    KEY_TYPE VARCHAR2(512) NOT NULL,
    CREATE_MODE VARCHAR2(30) DEFAULT 'CREATED',
    STATE VARCHAR2(30) NOT NULL,
    KEY_MANAGER VARCHAR2(512),
    APP_INFO BLOB DEFAULT NULL,
    FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID),
    PRIMARY KEY(APPLICATION_ID,KEY_TYPE,KEY_MANAGER)

    FOR EACH ROW
      BEGIN
        DELETE FROM AM_API_PRODUCT_MAPPING AAPM WHERE AAPM.URL_MAPPING_ID = :OLD.URL_MAPPING_ID;
        DELETE FROM AM_API_RESOURCE_SCOPE_MAPPING AARSM WHERE AARSM.URL_MAPPING_ID = :OLD.URL_MAPPING_ID;
      END;
/
CREATE or REPLACE TRIGGER TRG_DEL_AM_APPLICATION
