diff --git a/mifosng-db/migrations/V1__mifosplatform-core-ddl-latest.sql b/mifosng-db/migrations/V1__mifosplatform-core-ddl-latest.sql index 54a24d01b..339ef8b0b 100644 --- a/mifosng-db/migrations/V1__mifosplatform-core-ddl-latest.sql +++ b/mifosng-db/migrations/V1__mifosplatform-core-ddl-latest.sql @@ -595,6 +595,7 @@ CREATE TABLE `m_loan_arrears_aging` ( CREATE TABLE `m_guarantor` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `loan_id` BIGINT(20) NOT NULL, + `client_reln_cv_id` INT(11) DEFAULT NULL, `type_enum` SMALLINT(5) NOT NULL, `entity_id` BIGINT(20) NULL DEFAULT NULL, `firstname` VARCHAR(50) NULL DEFAULT NULL, @@ -611,6 +612,7 @@ CREATE TABLE `m_guarantor` ( `comment` VARCHAR(500) NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `FK_m_guarantor_m_loan` (`loan_id`), + CONSTRAINT `FK_m_guarantor_m_code_value` FOREIGN KEY (`client_reln_cv_id`) REFERENCES `m_code_value` (`id`), CONSTRAINT `FK_m_guarantor_m_loan` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -642,6 +644,7 @@ CREATE TABLE `m_loan_collateral` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `loan_id` bigint(20) NOT NULL, `type_cv_id` int(11) NOT NULL, + `value` DECIMAL(19,6) DEFAULT NULL, `description` varchar(500) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK_collateral_m_loan` (`loan_id`), diff --git a/mifosng-db/migrations/V2__mifosx-base-reference-data-utf8.sql b/mifosng-db/migrations/V2__mifosx-base-reference-data-utf8.sql index 80a68352d..1393ea946 100644 --- a/mifosng-db/migrations/V2__mifosx-base-reference-data-utf8.sql +++ b/mifosng-db/migrations/V2__mifosx-base-reference-data-utf8.sql @@ -271,7 +271,8 @@ VALUES ('LoanCollateral',1), ('LoanPurpose',1), ('Gender',1), -('YesNo',1); +('YesNo',1), +('GuarantorRelationship',1); INSERT INTO `m_code_value`(`code_id`,`code_value`,`order_position`) select mc.id, 'Passport', 1 @@ -291,4 +292,30 @@ where mc.`code_name` = "Customer Identifier"; INSERT INTO `m_code_value`(`code_id`,`code_value`,`order_position`) select mc.id, 'Any Other Id Type', 4 from m_code mc -where mc.`code_name` = "Customer Identifier"; \ No newline at end of file +where mc.`code_name` = "Customer Identifier"; + +-- Adding a few Default Guarantor Relationships +insert into m_code_value (code_id,code_value,order_position) + select id,"Spouse",0 + from m_code + where m_code.code_name="GuarantorRelationship"; + +insert into m_code_value (code_id,code_value,order_position) + select id,"Parent",0 + from m_code + where m_code.code_name="GuarantorRelationship"; + +insert into m_code_value (code_id,code_value,order_position) + select id,"Sibling",0 + from m_code + where m_code.code_name="GuarantorRelationship"; + +insert into m_code_value (code_id,code_value,order_position) + select id,"Business Associate",0 + from m_code + where m_code.code_name="GuarantorRelationship"; + +insert into m_code_value (code_id,code_value,order_position) + select id,"Other",0 + from m_code + where m_code.code_name="GuarantorRelationship"; \ No newline at end of file diff --git a/mifosng-db/migrations/V3__mifosx-permissions-and-authorisation-utf8.sql b/mifosng-db/migrations/V3__mifosx-permissions-and-authorisation-utf8.sql index 971065a42..aaf726ab1 100644 --- a/mifosng-db/migrations/V3__mifosx-permissions-and-authorisation-utf8.sql +++ b/mifosng-db/migrations/V3__mifosx-permissions-and-authorisation-utf8.sql @@ -220,6 +220,13 @@ INSERT INTO `m_permission` ('portfolio', 'UPDATE_GUARANTOR_CHECKER', 'GUARANTOR', 'UPDATE', 0), ('portfolio', 'DELETE_GUARANTOR', 'GUARANTOR', 'DELETE', 1), ('portfolio', 'DELETE_GUARANTOR_CHECKER', 'GUARANTOR', 'DELETE', 0), +('portfolio', 'READ_COLLATERAL', 'COLLATERAL', 'READ', '0'), +('portfolio', 'CREATE_COLLATERAL', 'COLLATERAL', 'CREATE', '1'), +('portfolio', 'UPDATE_COLLATERAL', 'COLLATERAL', 'UPDATE', '1'), +('portfolio', 'DELETE_COLLATERAL', 'COLLATERAL', 'DELETE', '1'), +('portfolio', 'CREATE_COLLATERAL_CHECKER', 'COLLATERAL', 'CREATE', '0'), +('portfolio', 'UPDATE_COLLATERAL_CHECKER', 'COLLATERAL', 'UPDATE', '0'), +('portfolio', 'DELETE_COLLATERAL_CHECKER', 'COLLATERAL', 'DELETE', '0'), ('transaction_loan', 'APPROVE_LOAN', 'LOAN', 'APPROVE', '1'), ('transaction_loan', 'APPROVEINPAST_LOAN', 'LOAN', 'APPROVEINPAST', '1'), ('transaction_loan', 'REJECT_LOAN', 'LOAN', 'REJECT', '1'), diff --git a/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql b/mifosng-db/old-schema-files/0001a-mifosplatform-core-ddl-latest.sql similarity index 100% rename from mifosng-db/0001a-mifosplatform-core-ddl-latest.sql rename to mifosng-db/old-schema-files/0001a-mifosplatform-core-ddl-latest.sql diff --git a/mifosng-db/0002-mifosx-base-reference-data-utf8.sql b/mifosng-db/old-schema-files/0002-mifosx-base-reference-data-utf8.sql similarity index 100% rename from mifosng-db/0002-mifosx-base-reference-data-utf8.sql rename to mifosng-db/old-schema-files/0002-mifosx-base-reference-data-utf8.sql diff --git a/mifosng-db/0003-mifosx-permissions-and-authorisation-utf8.sql b/mifosng-db/old-schema-files/0003-mifosx-permissions-and-authorisation-utf8.sql similarity index 100% rename from mifosng-db/0003-mifosx-permissions-and-authorisation-utf8.sql rename to mifosng-db/old-schema-files/0003-mifosx-permissions-and-authorisation-utf8.sql diff --git a/mifosng-db/0004-mifosx-core-reports-utf8.sql b/mifosng-db/old-schema-files/0004-mifosx-core-reports-utf8.sql similarity index 100% rename from mifosng-db/0004-mifosx-core-reports-utf8.sql rename to mifosng-db/old-schema-files/0004-mifosx-core-reports-utf8.sql diff --git a/mifosng-db/patches/1-add-status-to-savings-account.sql b/mifosng-db/patchesPutOnDemoServer20130401/1-add-status-to-savings-account.sql similarity index 100% rename from mifosng-db/patches/1-add-status-to-savings-account.sql rename to mifosng-db/patchesPutOnDemoServer20130401/1-add-status-to-savings-account.sql diff --git a/mifosng-db/patches/2-audit-add-account-savings-id.sql b/mifosng-db/patchesPutOnDemoServer20130401/2-audit-add-account-savings-id.sql similarity index 100% rename from mifosng-db/patches/2-audit-add-account-savings-id.sql rename to mifosng-db/patchesPutOnDemoServer20130401/2-audit-add-account-savings-id.sql diff --git a/mifosng-db/patches/3-collateral-add-value.sql b/mifosng-db/patchesPutOnDemoServer20130401/3-collateral-add-value.sql old mode 100755 new mode 100644 similarity index 100% rename from mifosng-db/patches/3-collateral-add-value.sql rename to mifosng-db/patchesPutOnDemoServer20130401/3-collateral-add-value.sql diff --git a/mifosng-db/patches/4-add-interest-calculation-fields.sql b/mifosng-db/patchesPutOnDemoServer20130401/4-add-interest-calculation-fields.sql similarity index 100% rename from mifosng-db/patches/4-add-interest-calculation-fields.sql rename to mifosng-db/patchesPutOnDemoServer20130401/4-add-interest-calculation-fields.sql diff --git a/mifosng-db/patches/5-guarantor-add-relationship.sql b/mifosng-db/patchesPutOnDemoServer20130401/5-guarantor-add-relationship.sql old mode 100755 new mode 100644 similarity index 100% rename from mifosng-db/patches/5-guarantor-add-relationship.sql rename to mifosng-db/patchesPutOnDemoServer20130401/5-guarantor-add-relationship.sql