--
--

SET escape_string_warning = off;




--
-- Name: loan_payment_detail_nupay; Type: TABLE; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

CREATE TABLE loan_payment_detail_nupay (
    loan_payment_id integer NOT NULL,
    nupay_transaction_id bigint NOT NULL,
    nupay_result_code integer NOT NULL,
    nupay_reply_ts timestamp without time zone NOT NULL
);


ALTER TABLE bbrk.loan_payment_detail_nupay OWNER TO mysqltest;

--
-- Name: loan_payment_detail_nupay_pkey; Type: CONSTRAINT; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

ALTER TABLE ONLY loan_payment_detail_nupay
    ADD CONSTRAINT loan_payment_detail_nupay_pkey PRIMARY KEY (loan_payment_id);


--
-- Name: unq_lpdn_nupaytransactionreplystatus; Type: CONSTRAINT; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

ALTER TABLE ONLY loan_payment_detail_nupay
    ADD CONSTRAINT unq_lpdn_nupaytransactionreplystatus UNIQUE (nupay_transaction_id, nupay_reply_ts, nupay_result_code);


--
-- Name: indx_lpdn_nupayresult; Type: INDEX; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

CREATE INDEX indx_lpdn_nupayresult ON loan_payment_detail_nupay USING btree (nupay_result_code);


--
-- Name: indx_lpdn_nupaytransactionreply; Type: INDEX; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

CREATE INDEX indx_lpdn_nupaytransactionreply ON loan_payment_detail_nupay USING btree (nupay_transaction_id, nupay_reply_ts);


--
-- Name: indx_lpdnupay_replyts; Type: INDEX; Schema: bbrk; Owner: mysqltest; Tablespace: 
--

CREATE INDEX indx_lpdnupay_replyts ON loan_payment_detail_nupay USING btree (nupay_reply_ts);


--
-- Name: tgr_loan_payment_detail_nupay_after_insert; Type: TRIGGER; Schema: bbrk; Owner: mysqltest
--

CREATE TRIGGER tgr_loan_payment_detail_nupay_after_insert
    AFTER INSERT ON loan_payment_detail_nupay
    FOR EACH ROW
    EXECUTE PROCEDURE tgrf_loan_payment_detail_nupay_after_insert();


--
-- Name: fk_lpdn_payment; Type: FK CONSTRAINT; Schema: bbrk; Owner: mysqltest
--

ALTER TABLE ONLY loan_payment_detail_nupay
    ADD CONSTRAINT fk_lpdn_payment FOREIGN KEY (loan_payment_id) REFERENCES loan_payments(dkey);


--
--

