update base DDL and reference data after server upgrade.

This commit is contained in:
Keith Woodlock
2012-11-25 02:48:55 +00:00
parent 8859c44765
commit fbf54d3c64
57 changed files with 66 additions and 493 deletions
@@ -96,6 +96,7 @@ CREATE TABLE `ref_loan_transaction_processing_strategy` (
CREATE TABLE `m_code` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code_name` varchar(100) DEFAULT NULL,
`is_system_defined` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `code_name` (`code_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -194,10 +195,9 @@ CREATE TABLE `m_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`grouping` varchar(45) DEFAULT NULL,
`code` varchar(100) NOT NULL,
`default_description` varchar(500) NOT NULL,
`default_name` varchar(100) NOT NULL,
`entity_name` varchar(100) DEFAULT NULL,
`action_name` varchar(100) DEFAULT NULL,
`is_maker_checker` TINYINT(1) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -265,7 +265,7 @@ CREATE TABLE `m_portfolio_command_source` (
`api_operation` varchar(20) NOT NULL,
`api_resource` varchar(20) NOT NULL,
`resource_id` bigint(20) DEFAULT NULL,
`command_as_json` varchar(1000) NOT NULL,
`command_as_json` varchar(5000) NOT NULL,
`maker_id` bigint(20) NOT NULL,
`made_on_date` date NOT NULL,
`checker_id` bigint(20) DEFAULT NULL,
File diff suppressed because one or more lines are too long
@@ -1,39 +0,0 @@
DROP TABLE if exists `portfolio_deposit_account`;
CREATE TABLE `portfolio_deposit_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`deposit_amount` decimal(19,6) DEFAULT NULL,
`maturity_nominal_interest_rate` decimal(19,6) NOT NULL,
`tenure_months` int(11) NOT NULL,
`interest_compounding_frequency` smallint(5) NOT NULL DEFAULT '1',
`interest_compounding_frequency_enum` smallint(5) NOT NULL DEFAULT '2',
`projected_commencement_date` DATE NOT NULL,
`actual_commencement_date` DATE DEFAULT NULL,
`projected_maturity_date` DATE NOT NULL,
`actual_maturity_date` DATE DEFAULT NULL,
`projected_interest_accrued_on_maturity` decimal(19,6) NOT NULL,
`actual_interest_accrued` decimal(19,6) DEFAULT NULL,
`projected_total_maturity_amount` decimal(19,6) NOT NULL,
`actual_total_amount` decimal(19,6) DEFAULT NULL,
`can_renew` tinyint(1) NOT NULL DEFAULT '0',
`renewed_account_id` bigint(20) DEFAULT NULL,
`can_pre_close` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKKW0000000000001` (`client_id`),
KEY `FKKW0000000000002` (`product_id`),
KEY `FKKW0000000000003` (`renewed_account_id`),
CONSTRAINT `FKKW0000000000001` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FKKW0000000000002` FOREIGN KEY (`product_id`) REFERENCES `portfolio_product_deposit` (`id`),
CONSTRAINT `FKKW0000000000003` FOREIGN KEY (`renewed_account_id`) REFERENCES `portfolio_deposit_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,10 +0,0 @@
UPDATE `ref_currency`
SET
`display_symbol` = 'R'
WHERE id=161;
UPDATE `org_organisation_currency`
SET
`display_symbol` = 'R'
WHERE code like 'ZAR';
@@ -1,74 +0,0 @@
DROP TABLE if exists `portfolio_deposit_account`;
DROP TABLE if exists `portfolio_product_deposit`;
CREATE TABLE `portfolio_product_deposit` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`description` varchar(500) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`minimum_balance` decimal(19,6) DEFAULT NULL,
`maximum_balance` decimal(19,6) DEFAULT NULL,
`tenure_months` int(11) NOT NULL,
`interest_compounded_every` smallint(5) NOT NULL DEFAULT '1',
`interest_compounded_every_period_enum` smallint(5) NOT NULL DEFAULT '2',
`maturity_default_interest_rate` decimal(19,6) NOT NULL,
`maturity_min_interest_rate` decimal(19,6) NOT NULL,
`maturity_max_interest_rate` decimal(19,6) NOT NULL,
`is_renewal_allowed` tinyint(1) NOT NULL DEFAULT '0',
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_deposit_product` (`name`),
UNIQUE KEY `externalid_deposit_product` (`external_id`),
KEY `FKJPW0000000000003` (`createdby_id`),
KEY `FKJPW0000000000004` (`lastmodifiedby_id`),
CONSTRAINT `FKJPX0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `admin_appuser` (`id`),
CONSTRAINT `FKJPX0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `admin_appuser` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `portfolio_deposit_account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`external_id` varchar(100) DEFAULT NULL,
`client_id` bigint(20) NOT NULL,
`product_id` bigint(20) NOT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`deposit_amount` decimal(19,6) DEFAULT NULL,
`maturity_nominal_interest_rate` decimal(19,6) NOT NULL,
`tenure_months` int(11) NOT NULL,
`interest_compounded_every` smallint(5) NOT NULL DEFAULT '1',
`interest_compounded_every_period_enum` smallint(5) NOT NULL DEFAULT '2',
`projected_commencement_date` DATE NOT NULL,
`actual_commencement_date` DATE DEFAULT NULL,
`projected_maturity_date` DATE NOT NULL,
`actual_maturity_date` DATE DEFAULT NULL,
`projected_interest_accrued_on_maturity` decimal(19,6) NOT NULL,
`actual_interest_accrued` decimal(19,6) DEFAULT NULL,
`projected_total_maturity_amount` decimal(19,6) NOT NULL,
`actual_total_amount` decimal(19,6) DEFAULT NULL,
`is_renewal_allowed` tinyint(1) NOT NULL DEFAULT '0',
`renewed_account_id` bigint(20) DEFAULT NULL,
`is_preclosure_allowed` tinyint(1) NOT NULL DEFAULT '0',
`pre_closure_interest_rate` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `deposit_acc_external_id` (`external_id`),
KEY `FKKW0000000000001` (`client_id`),
KEY `FKKW0000000000002` (`product_id`),
KEY `FKKW0000000000003` (`renewed_account_id`),
CONSTRAINT `FKKW0000000000001` FOREIGN KEY (`client_id`) REFERENCES `portfolio_client` (`id`),
CONSTRAINT `FKKW0000000000002` FOREIGN KEY (`product_id`) REFERENCES `portfolio_product_deposit` (`id`),
CONSTRAINT `FKKW0000000000003` FOREIGN KEY (`renewed_account_id`) REFERENCES `portfolio_deposit_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,13 +0,0 @@
CREATE TABLE `o_charge` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`amount` decimal(19,6) NOT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT 0,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,28 +0,0 @@
CREATE TABLE `r_code` (
`id` int NOT NULL AUTO_INCREMENT,
`code_name` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `code_name` (`code_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `r_code_value` (
`id` int NOT NULL AUTO_INCREMENT,
`code_id` int NOT NULL,
`code_value` varchar(100) DEFAULT NULL,
`order_position` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `code_value` (`code_id`, `code_value`),
KEY `FKCFCEA42640BE071Z` (`code_id`),
CONSTRAINT `FKCFCEA42640BE071Z` FOREIGN KEY (`code_id`) REFERENCES `r_code` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*not a major table - just intended for database reporting use for enums and values that would be hidden in java*/
CREATE TABLE `r_enum_value` (
`enum_name` varchar(100) NOT NULL,
`enum_id` int NOT NULL,
`enum_message_property` varchar(100) NOT NULL,
`enum_value` varchar(100) NOT NULL,
PRIMARY KEY (`enum_name`, `enum_id`),
UNIQUE KEY `enum_message_property` (`enum_name`, `enum_message_property`),
UNIQUE KEY `enum_value` (`enum_name`, `enum_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,6 +0,0 @@
ALTER TABLE `portfolio_loan` DROP FOREIGN KEY `FK7C885878B1147D1`;
ALTER TABLE `portfolio_loan` DROP INDEX `FK7C885878B1147D1`;
drop table `ref_loan_status`;
@@ -1,24 +0,0 @@
ALTER TABLE admin_appuser RENAME TO m_appuser;
ALTER TABLE admin_appuser_role RENAME TO m_appuser_role;
ALTER TABLE admin_permission RENAME TO m_permission;
ALTER TABLE admin_role RENAME TO m_role;
ALTER TABLE admin_role_permission RENAME TO m_role_permission;
ALTER TABLE o_charge RENAME TO m_charge;
ALTER TABLE org_fund RENAME TO m_fund;
ALTER TABLE org_office RENAME TO m_office;
ALTER TABLE org_organisation_currency RENAME TO m_organisation_currency;
ALTER TABLE portfolio_client RENAME TO m_client;
ALTER TABLE portfolio_deposit_account RENAME TO m_deposit_account;
ALTER TABLE portfolio_group RENAME TO m_group;
ALTER TABLE portfolio_group_client RENAME TO m_group_client;
ALTER TABLE portfolio_loan RENAME TO m_loan;
ALTER TABLE portfolio_loan_repayment_schedule RENAME TO m_loan_repayment_schedule;
ALTER TABLE portfolio_loan_transaction RENAME TO m_loan_transaction;
ALTER TABLE portfolio_note RENAME TO m_note;
ALTER TABLE portfolio_office_transaction RENAME TO m_office_transaction;
ALTER TABLE portfolio_product_deposit RENAME TO m_product_deposit;
ALTER TABLE portfolio_product_loan RENAME TO m_product_loan;
ALTER TABLE portfolio_product_savings RENAME TO m_product_savings;
ALTER TABLE r_code RENAME TO m_code;
ALTER TABLE r_code_value RENAME TO m_code_value;
ALTER TABLE ref_currency RENAME TO m_currency;
@@ -1,6 +0,0 @@
ALTER TABLE `portfolio_client_extra_Additional Information` RENAME TO `m_client_xAdditional Information` ;
ALTER TABLE `portfolio_client_extra_Highly Improbable Info` RENAME TO `m_client_xHighly Improbable Info`;
ALTER TABLE `portfolio_loan_extra_Additional Information` RENAME TO `m_loan_xAdditional Information`;
@@ -1,16 +0,0 @@
ALTER TABLE `m_charge`
ADD COLUMN `currency_code` VARCHAR(3) NOT NULL AFTER `name` ,
ADD COLUMN `charge_applies_to_enum` SMALLINT(5) NOT NULL AFTER `currency_code` ,
ADD COLUMN `charge_time_enum` SMALLINT(5) NOT NULL AFTER `charge_applies_to_enum` ,
ADD COLUMN `charge_calculation_enum` SMALLINT(5) NOT NULL AFTER `charge_time_enum` ,
ADD COLUMN `is_active` TINYINT(1) NOT NULL AFTER `amount` ;
CREATE TABLE `m_product_loan_charge` (
`product_loan_id` bigint(20) NOT NULL,
`charge_id` bigint(20) NOT NULL,
PRIMARY KEY (`product_loan_id`, `charge_id`),
KEY `charge_id` (`charge_id`),
CONSTRAINT `m_product_loan_charge_ibfk_1` FOREIGN KEY (`charge_id`) REFERENCES `m_charge` (`id`),
CONSTRAINT `m_product_loan_charge_ibfk_2` FOREIGN KEY (`product_loan_id`) REFERENCES `m_product_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,8 +0,0 @@
CREATE TABLE `m_staff` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`display_name` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `display_name` (`display_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,16 +0,0 @@
ALTER TABLE `m_deposit_account` ADD COLUMN `status_enum` smallint(5) NOT NULL DEFAULT 0 AFTER `is_deleted`;
DROP TABLE IF EXISTS `m_deposit_account_transaction`;
CREATE TABLE `m_deposit_account_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`deposit_account_id` bigint(20) NOT NULL,
`transaction_type_enum` smallint(5) NOT NULL,
`contra_id` bigint(20) DEFAULT NULL,
`transaction_date` date NOT NULL,
`amount` decimal(19,6) NOT NULL,
PRIMARY KEY (`id`),
KEY `FKKW00000000000005` (`deposit_account_id`),
KEY `FKKW00000000000006` (`contra_id`),
CONSTRAINT `FKKW00000000000005` FOREIGN KEY (`deposit_account_id`) REFERENCES `m_deposit_account` (`id`),
CONSTRAINT `FKKW00000000000006` FOREIGN KEY (`contra_id`) REFERENCES `m_deposit_account_transaction` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@@ -1,4 +0,0 @@
ALTER TABLE `m_deposit_account`
ADD COLUMN `withdrawnon_date` datetime DEFAULT NULL AFTER `pre_closure_interest_rate`,
ADD COLUMN `rejectedon_date` datetime DEFAULT NULL AFTER `withdrawnon_date`,
ADD COLUMN `closedon_date` datetime DEFAULT NULL AFTER `rejectedon_date`;
@@ -1,2 +0,0 @@
ALTER TABLE `m_appuser`
ADD COLUMN `is_deleted` TINYINT(1) DEFAULT 0 NOT NULL AFTER `id`;
@@ -1,12 +0,0 @@
CREATE TABLE `m_loan_charge` (
`loan_id` bigint(20) NOT NULL,
`charge_id` bigint(20) NOT NULL,
`charge_time_enum` smallint(5) NOT NULL,
`charge_calculation_enum` smallint(5) NOT NULL,
`amount` decimal(19,6) NOT NULL,
PRIMARY KEY (`loan_id`,`charge_id`),
KEY `charge_id` (`charge_id`),
CONSTRAINT `m_loan_charge_ibfk_1` FOREIGN KEY (`charge_id`) REFERENCES `m_charge` (`id`),
CONSTRAINT `m_loan_charge_ibfk_2` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,35 +0,0 @@
insert into m_code (code_name)
select name from stretchydata_allowed_list;
insert into m_code_value (code_id, code_value, order_position)
select c.id, sv.name, sv.id
from stretchydata_allowed_value sv
join stretchydata_allowed_list sl on sv.allowed_list_id = sl.id
join m_code c on c.code_name = sl.name;
SET foreign_key_checks = 0;
ALTER TABLE `stretchydata_dataset_fields` DROP FOREIGN KEY `stretchydata_dataset_fields_fk2` ;
ALTER TABLE `stretchydata_dataset_fields`
CHANGE COLUMN `allowed_list_id` `code_id` INT(11) NULL DEFAULT NULL ,
ADD CONSTRAINT `stretchydata_dataset_fields_fk2`
FOREIGN KEY (`code_id` )
REFERENCES `m_code` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION;
SET foreign_key_checks = 1;
update stretchydata_dataset_fields f
join stretchydata_allowed_list l on l.id = f.code_id
join m_code c on c.code_name = l.name
set code_id = c.id
where f.code_id is not null;
DROP TABLE `stretchydata_allowed_value`;
DROP TABLE `stretchydata_allowed_list`;
@@ -1,23 +0,0 @@
insert into m_permission (group_enum, code, default_description, default_name)
select 3, concat("CAN_RUN_", report_name), concat("CAN_RUN_", report_name), concat("CAN_RUN_", report_name)
from stretchy_report r
where not exists
(select 'f' from m_permission x
where x.code = concat("CAN_RUN_", r.report_name));
insert into m_permission (group_enum, code, default_description, default_name)
select 3, concat("CAN_READ_", t.`name`, "_x", d.`name`), concat("CAN_READ_", t.`name`, "_x", d.`name`), concat("CAN_READ_", t.`name`, "_x", d.`name`)
from stretchydata_dataset d
join stretchydata_datasettype t on t.id = d.datasettype_id
where not exists
(select 'f' from m_permission x
where x.code = concat("CAN_READ_", t.`name`, "_x", d.`name`));
insert into m_permission (group_enum, code, default_description, default_name)
select 3, concat("CAN_UPDATE_", t.`name`, "_x", d.`name`), concat("CAN_UPDATE_", t.`name`, "_x", d.`name`), concat("CAN_UPDATE_", t.`name`, "_x", d.`name`)
from stretchydata_dataset d
join stretchydata_datasettype t on t.id = d.datasettype_id
where not exists
(select 'f' from m_permission x
where x.code = concat("CAN_UPDATE_", t.`name`, "_x", d.`name`));
@@ -1,14 +0,0 @@
insert into m_permission (group_enum, code, default_description, default_name)
values (0, "ALL_FUNCTIONS", "An application user will have permission to execute all tasks.", "ALL");
insert into m_permission (group_enum, code, default_description, default_name)
values (0, "ALL_FUNCTIONS_READ", "An application user will have permission to execute all read tasks.", "ALL READ");
/* give default super user role the all_functions permissions as well as current ones for now */
insert into m_role_permission (permission_id, role_id)
select p.id, 1
from m_permission p
where p.code = "ALL_FUNCTIONS";
@@ -1,5 +0,0 @@
ALTER TABLE `m_staff`
ADD COLUMN `createdby_id` BIGINT(20) NULL DEFAULT NULL,
ADD COLUMN`created_date` DATETIME NULL DEFAULT NULL,
ADD COLUMN`lastmodifiedby_id` BIGINT(20) NULL DEFAULT NULL,
ADD COLUMN`lastmodified_date` DATETIME NULL DEFAULT NULL;
@@ -1,4 +0,0 @@
ALTER TABLE `m_client`
ADD COLUMN `display_name` VARCHAR(100) NOT NULL AFTER `lastname`;
update m_client set display_name = concat_ws(' ',firstname,lastname);
@@ -1,3 +0,0 @@
alter table m_deposit_account drop column actual_maturity_date;
alter table m_deposit_account drop column projected_maturity_date;
alter table `m_deposit_account` add column `matured_on` datetime NULL DEFAULT NULL after actual_commencement_date;
@@ -1,2 +0,0 @@
alter table m_deposit_account drop column `matured_on`;
alter table `m_deposit_account` add column `matures_on_date` datetime NULL DEFAULT NULL after actual_commencement_date;
@@ -1,12 +0,0 @@
/* used to link MySql tables to Mifos X application tables for additional data needs */
DROP TABLE IF EXISTS `x_registered_table`;
CREATE TABLE `x_registered_table` (
`registered_table_name` varchar(50) NOT NULL,
`registered_table_label` varchar(80) NOT NULL,
`application_table_name` varchar(50) NOT NULL,
PRIMARY KEY (`registered_table_name`),
UNIQUE KEY `registered_table_label` (`registered_table_label`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,3 +0,0 @@
ALTER TABLE `m_loan`
ADD COLUMN `loan_officer_id` BIGINT(20) NULL AFTER `fund_id`,
ADD CONSTRAINT `FK_m_loan_m_staff` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`);
@@ -1,9 +0,0 @@
ALTER TABLE `m_staff`
ADD COLUMN `office_id` BIGINT(20) NULL AFTER `id`,
ADD CONSTRAINT `FK_m_staff_m_office` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`);
ALTER TABLE `m_staff`
ADD COLUMN `is_loan_officer` TINYINT(1) NOT NULL DEFAULT 0 AFTER `id`;
update m_staff set office_id=1;
@@ -1,4 +0,0 @@
ALTER TABLE `m_note`
ADD COLUMN `deposit_account_id` bigint(20) DEFAULT NULL AFTER `loan_transaction_id`,
ADD KEY `FK_m_note_m_deposit_account` (`deposit_account_id`),
ADD CONSTRAINT `FK_m_note_m_deposit_account` FOREIGN KEY (`deposit_account_id`) REFERENCES `m_deposit_account` (`id`);
@@ -1,9 +0,0 @@
UPDATE `mifostenant-heavensfamily`.`m_loan`
SET
`loan_transaction_strategy_id` = 2
WHERE id > 0;
UPDATE `mifostenant-heavensfamily`.`m_loan`
SET
`term_frequency` = `repay_every` * `number_of_repayments`
WHERE `term_frequency` = 0;
@@ -1,2 +0,0 @@
ALTER TABLE `m_loan`
ADD COLUMN `total_charges_due_at_disbursement_derived` bigint(20) DEFAULT NULL AFTER `interest_rebate_amount`;
@@ -1,13 +0,0 @@
DROP TABLE `m_loan_charge`;
CREATE TABLE `m_loan_charge` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`charge_id` bigint(20) NOT NULL,
`charge_time_enum` smallint(5) NOT NULL,
`charge_calculation_enum` smallint(5) NOT NULL,
`amount` decimal(19,6) NOT NULL,
PRIMARY KEY (`id`),
KEY `charge_id` (`charge_id`),
CONSTRAINT `m_loan_charge_ibfk_1` FOREIGN KEY (`charge_id`) REFERENCES `m_charge` (`id`),
CONSTRAINT `m_loan_charge_ibfk_2` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
@@ -1,13 +0,0 @@
ALTER TABLE `m_deposit_account_transaction`
ADD COLUMN `interest` decimal(19,6) NOT NULL AFTER `amount`,
ADD COLUMN `total` decimal(19,6) NOT NULL AFTER `interest`;
ALTER TABLE `m_deposit_account`
ADD COLUMN `interest_paid` decimal(19,6) NOT NULL DEFAULT 0 AFTER `actual_total_amount`,
ADD COLUMN `is_interest_withdrawable` tinyint(1) NOT NULL DEFAULT '0' AFTER `interest_paid`;
ALTER TABLE `m_product_deposit`
ADD COLUMN `is_compounding_interest_allowed` tinyint(1) NOT NULL DEFAULT '0' AFTER `maturity_max_interest_rate`;
ALTER TABLE `m_deposit_account`
ADD COLUMN `is_compounding_interest_allowed` tinyint(1) NOT NULL DEFAULT '0' AFTER `actual_total_amount`;
@@ -1,3 +0,0 @@
ALTER TABLE `m_loan`
DROP COLUMN `total_charges_due_at_disbursement_derived`,
ADD COLUMN `total_charges_due_at_disbursement_derived` decimal(19,6) DEFAULT NULL AFTER `interest_rebate_amount`;
@@ -1,7 +0,0 @@
DROP TABLE IF EXISTS `x_registered_table`;
/* used to link MySql tables to Mifos X application tables for additional data needs */
CREATE TABLE `x_registered_table` (
`registered_table_name` varchar(50) NOT NULL,
`application_table_name` varchar(50) NOT NULL,
PRIMARY KEY (`registered_table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,2 +0,0 @@
ALTER TABLE `m_loan_transaction`
ADD COLUMN `charges_portion_derived` decimal(19,6) DEFAULT NULL AFTER `interest_waived_derived`;
@@ -1,3 +0,0 @@
alter table m_group add column office_id bigint(20) NOT NULL AFTER id;
update m_group set office_id = 1 WHERE office_id = 0;
alter table m_group add constraint foreign key (`office_id`) references `m_office` (`id`);
@@ -1,10 +0,0 @@
ALTER TABLE `m_loan_charge`
ADD COLUMN `calculation_percentage` decimal(19,6) DEFAULT NULL AFTER `charge_calculation_enum`;
ALTER TABLE `m_loan_charge`
ADD COLUMN `calculation_on_amount` decimal(19,6) DEFAULT NULL AFTER `calculation_percentage`;
ALTER TABLE `m_loan_charge`
ADD COLUMN `amount_paid_derived` decimal(19,6) DEFAULT NULL AFTER `amount`;
ALTER TABLE `m_loan_charge`
ADD COLUMN `amount_outstanding_derived` decimal(19,6) NOT NULL default 0 AFTER `amount_paid_derived`;
ALTER TABLE `m_loan_charge`
ADD COLUMN `is_paid_derived` tinyint(1) NOT NULL default 0 AFTER `amount_outstanding_derived`;