Skip to content

Commit

Permalink
Updated db scripts to index refid but not otphash
Browse files Browse the repository at this point in the history
Signed-off-by: Loganathan Sekar <[email protected]>
  • Loading branch information
Loganathan Sekar authored and Loganathan Sekar committed Feb 7, 2024
1 parent 6b9c13b commit 03d93bf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
public interface OtpTxnRepository extends BaseRepository<OtpTransaction, String> {

/**
* 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<OtpTransaction> findByOtpHashAndStatusCode(String otpHash, String statusCode);

Optional<OtpTransaction> findFirstByRefIdOrderByGeneratedDtimesDesc(String refIdHash);

}
2 changes: 1 addition & 1 deletion db_scripts/mosip_ida/ddl/ida-otp_transaction.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 03d93bf

Please sign in to comment.