All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.billing.killbill-util.0.24.8.source-code.cleanAccount-postgresql.sql Maven / Gradle / Ivy

There is a newer version: 0.24.11
Show newest version
CREATE OR REPLACE PROCEDURE cleanAccount(p_account_id varchar(36)) LANGUAGE plpgsql
AS $$
DECLARE
    v_account_record_id bigint;
    v_tenant_record_id bigint;

BEGIN
    select record_id, tenant_record_id from accounts WHERE id = p_account_id into v_account_record_id, v_tenant_record_id;

    call trimAccount(p_account_id);

    DELETE FROM account_history WHERE target_record_id = v_account_record_id and tenant_record_id = v_tenant_record_id;
    DELETE FROM accounts WHERE record_id = v_account_record_id and tenant_record_id = v_tenant_record_id;
    DELETE FROM audit_log WHERE account_record_id = v_account_record_id and tenant_record_id = v_tenant_record_id;
    DELETE FROM payment_method_history WHERE account_record_id = v_account_record_id and tenant_record_id = v_tenant_record_id;
    DELETE FROM payment_methods WHERE account_record_id = v_account_record_id and tenant_record_id = v_tenant_record_id;
END
$$;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy