--
--

SET escape_string_warning = off;




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

CREATE TABLE loan_payment_detail_mctdebit (
    loan_payment_id integer NOT NULL,
    cycle_date timestamp without time zone NOT NULL,
    reference character varying(14) NOT NULL,
    sequence_number bigint NOT NULL,
    response_code character varying(2) NOT NULL,
    client_bank_account_id bigint,
    effective_date timestamp without time zone,
    tracking_period_id integer,
    original_action_date timestamp without time zone NOT NULL
);


ALTER TABLE bbrk.loan_payment_detail_mctdebit OWNER TO mysqltest;

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

ALTER TABLE ONLY loan_payment_detail_mctdebit
    ADD CONSTRAINT loan_payment_detail_mctdebit_pkey PRIMARY KEY (loan_payment_id);


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

ALTER TABLE ONLY loan_payment_detail_mctdebit
    ADD CONSTRAINT unq_lpdmctd_unqref UNIQUE (cycle_date, reference, response_code, original_action_date);


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

CREATE INDEX indx_lpdmct_cba ON loan_payment_detail_mctdebit USING btree (client_bank_account_id);


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

CREATE TRIGGER tgr_loan_payment_detail_mctdebit_after_insert
    AFTER INSERT ON loan_payment_detail_mctdebit
    FOR EACH ROW
    EXECUTE PROCEDURE tgrf_loan_payment_detail_mctdebit_after_insert();


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

ALTER TABLE ONLY loan_payment_detail_mctdebit
    ADD CONSTRAINT fk_lpdmct_cba FOREIGN KEY (client_bank_account_id) REFERENCES client_bank_account(client_bank_account_id);


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

ALTER TABLE ONLY loan_payment_detail_mctdebit
    ADD CONSTRAINT fk_lpdmctd_payment FOREIGN KEY (loan_payment_id) REFERENCES loan_payments(dkey);


--
--

