diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OtpTxnRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OtpTxnRepository.java index 195ab19ce65..04baf478d10 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OtpTxnRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OtpTxnRepository.java @@ -13,14 +13,11 @@ public interface OtpTxnRepository extends BaseRepository { /** - * Find by otp hash and status code. + * Find first element by ref_id ordered by generated_dtimes in descending order. * - * @param otpHash the otp hash - * @param statusCode the status code + * @param refIdHash the ref id hash * @return the optional */ - Optional findByOtpHashAndStatusCode(String otpHash, String statusCode); - Optional findFirstByRefIdOrderByGeneratedDtimesDesc(String refIdHash); } diff --git a/db_scripts/mosip_ida/ddl/ida-otp_transaction.sql b/db_scripts/mosip_ida/ddl/ida-otp_transaction.sql index 8dc9662eb95..fdc483862cf 100644 --- a/db_scripts/mosip_ida/ddl/ida-otp_transaction.sql +++ b/db_scripts/mosip_ida/ddl/ida-otp_transaction.sql @@ -32,7 +32,7 @@ CREATE TABLE ida.otp_transaction( ); -- ddl-end -- --index section starts---- -CREATE INDEX ind_otphsh ON ida.otp_transaction (otp_hash,status_code); +CREATE INDEX ind_refid ON ida.otp_transaction (ref_id); --index section ends------ COMMENT ON TABLE ida.otp_transaction IS 'OTP Transaction: All OTP related data and validation details are maintained here for ID Authentication module.'; -- ddl-end -- diff --git a/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_rollback.sql b/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_rollback.sql index 1ea8a6e97f2..37b4fb58b16 100644 --- a/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_rollback.sql +++ b/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_rollback.sql @@ -1,3 +1,8 @@ \echo 'Upgrade Queries not required for the transition from 1.2.0.1-B5 to 1.2.0.1' ALTER TABLE ida.credential_event_store ALTER COLUMN credential_transaction_id type character varying(36); + +CREATE INDEX ind_otphsh ON ida.otp_transaction (otp_hash,status_code); + +DROP INDEX IF EXISTS ida.ind_refid; + diff --git a/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_upgrade.sql b/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_upgrade.sql index 36efab138ca..1e46a63bf46 100644 --- a/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_upgrade.sql +++ b/db_upgrade_scripts/mosip_ida/sql/1.2.0.1-B5_to_1.2.0.1_upgrade.sql @@ -1,3 +1,8 @@ \echo 'Upgrade Queries not required for transition from 1.2.0.1-B5 to 1.2.0.1' ALTER TABLE ida.credential_event_store ALTER COLUMN credential_transaction_id type character varying(64); + +DROP INDEX IF EXISTS ida.ind_otphsh; + +CREATE INDEX ind_refid ON ida.otp_transaction (ref_id); +