update DDL and reference data files and also demo dumps with latest schema and core reports work.

This commit is contained in:
Keith Woodlock
2013-02-21 01:59:27 +00:00
parent fd2515c1ff
commit a94dcb6f50
20 changed files with 318 additions and 225 deletions
@@ -22,6 +22,7 @@ DROP TABLE IF EXISTS `m_deposit_account_transaction`;
DROP TABLE IF EXISTS `m_document`;
DROP TABLE IF EXISTS `m_fund`;
DROP TABLE IF EXISTS `m_group`;
DROP TABLE IF EXISTS `m_group_level`;
DROP TABLE IF EXISTS `m_group_client`;
DROP TABLE IF EXISTS `m_guarantor`;
DROP TABLE IF EXISTS `m_loan`;
@@ -319,10 +320,25 @@ CREATE TABLE `m_staff` (
-- ============ end of organisation wide related tables ===========
-- DDL client/group related tables
CREATE TABLE `m_group_level` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`parent_id` INT(11) NULL DEFAULT NULL,
`super_parent` TINYINT(1) NOT NULL,
`level_name` VARCHAR(100) NOT NULL,
`recursable` TINYINT(1) NOT NULL,
`can_have_clients` TINYINT(1) NOT NULL,
PRIMARY KEY (`id`),
INDEX `Parent_levelId_reference` (`parent_id`),
CONSTRAINT `Parent_levelId_reference` FOREIGN KEY (`parent_id`) REFERENCES `m_group_level` (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`office_id` bigint(20) NOT NULL,
`loan_officer_id` BIGINT(20) DEFAULT NULL,
`staff_id` BIGINT(20) DEFAULT NULL,
`parent_id` BIGINT(20) NULL DEFAULT NULL,
`level_Id` INT(11) NOT NULL,
`hierarchy` VARCHAR(100) NULL DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
@@ -330,9 +346,11 @@ CREATE TABLE `m_group` (
UNIQUE KEY `name` (`name`),
UNIQUE KEY `external_id` (`external_id`),
KEY `office_id` (`office_id`),
KEY `loan_officer_id` (`loan_officer_id`),
KEY `staff_id` (`staff_id`),
CONSTRAINT `m_group_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`),
CONSTRAINT `FK_m_group_m_staff` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`)
CONSTRAINT `Parent_Id_reference` FOREIGN KEY (`parent_id`) REFERENCES `m_group` (`id`),
CONSTRAINT `FK_m_group_level` FOREIGN KEY (`level_Id`) REFERENCES `m_group_level` (`id`),
CONSTRAINT `FK_m_group_m_staff` FOREIGN KEY (`staff_id`) REFERENCES `m_staff` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `m_client` (
@@ -685,23 +703,17 @@ CREATE TABLE `m_loan_repayment_schedule` (
CREATE TABLE `m_loan_transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`loan_id` bigint(20) NOT NULL,
`is_reversed` TINYINT(1) 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,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`principal_portion_derived` decimal(19,6) DEFAULT NULL,
`interest_portion_derived` decimal(19,6) DEFAULT NULL,
`fee_charges_portion_derived` decimal(19,6) DEFAULT NULL,
`penalty_charges_portion_derived` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKCFCEA42640BE0710` (`loan_id`),
KEY `FKCFCEA426FC69F3F1` (`contra_id`),
CONSTRAINT `FKCFCEA42640BE0710` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`),
CONSTRAINT `FKCFCEA426FC69F3F1` FOREIGN KEY (`contra_id`) REFERENCES `m_loan_transaction` (`id`)
CONSTRAINT `FKCFCEA42640BE0710` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ======== end of loan related tables ==========
@@ -942,7 +954,7 @@ CREATE TABLE `acc_gl_journal_entry` (
`reversal_id` bigint(20) DEFAULT NULL,
`transaction_id` varchar(50) NOT NULL,
`reversed` tinyint(1) NOT NULL DEFAULT '0',
`portfolio_generated` tinyint(1) NOT NULL DEFAULT '0',
`manual_entry` TINYINT(1) NOT NULL DEFAULT '0',
`entry_date` date NOT NULL,
`type_enum` smallint(50) NOT NULL,
`amount` decimal(19,6) NOT NULL,
@@ -206,6 +206,9 @@ INSERT INTO `m_office` (`id`, `parent_id`, `hierarchy`, `external_id`, `name`, `
VALUES
(1,NULL,'.','1','Head Office','2009-01-01');
INSERT INTO `m_group_level` (`id`, `parent_id`, `is_super_parent`, `level_name`, `recursable`, `can_have_clients`) VALUES (1, NULL, 1, 'Center', 1, 0);
INSERT INTO `m_group_level` (`id`, `parent_id`, `is_super_parent`, `level_name`, `recursable`, `can_have_clients`) VALUES (2, 1, 0, 'Group', 0, 1);
-- ========= roles and permissions =========
/*
this scripts removes all current m_role_permission and m_permission entries
@@ -457,6 +460,18 @@ INSERT INTO `m_permission`
('transaction_deposit', 'INTEREST_DEPOSITACCOUNT_CHECKER', 'DEPOSITACCOUNT', 'INTEREST', '0'),
('transaction_deposit', 'RENEW_DEPOSITACCOUNT_CHECKER', 'DEPOSITACCOUNT', 'RENEW', '0');
-- == accounting related permissions
INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES
('accounting', 'CREATE_GLACCOUNT', 'GLACCOUNT', 'CREATE', 1),
('accounting', 'UPDATE_GLACCOUNT', 'GLACCOUNT', 'UPDATE', 1),
('accounting', 'DELETE_GLACCOUNT', 'GLACCOUNT', 'DELETE', 1),
('accounting', 'CREATE_GLCLOSURE', 'GLCLOSURE', 'CREATE', 1),
('accounting', 'UPDATE_GLCLOSURE', 'GLCLOSURE', 'UPDATE', 1),
('accounting', 'DELETE_GLCLOSURE', 'GLCLOSURE', 'DELETE', 1),
('accounting', 'CREATE_JOURNALENTRY', 'JOURNALENTRY', 'CREATE', 1),
('accounting', 'REVERSE_JOURNALENTRY', 'JOURNALENTRY', 'REVERSE', 1);
INSERT INTO `m_role` (`id`, `name`, `description`)
VALUES
(1,'Super user','This role provides all application permissions.');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
DELETE FROM `mifostenant-ceda`.`ref_loan_transaction_processing_strategy` WHERE id in (1, 3, 4);
DELETE FROM `ref_loan_transaction_processing_strategy` WHERE id in (1, 3, 4);
INSERT INTO `mifostenant-ceda`.`m_code` (`code_name`, `is_system_defined`)
INSERT INTO `m_code` (`code_name`, `is_system_defined`)
VALUES
('FieldOfEmployment', '0'),
('EducationLevel', '0'),
@@ -142,8 +142,8 @@ where mc.`code_name` = "YesNo";
DROP TABLE IF EXISTS `mifostenant-ceda`.`client additional data`;
CREATE TABLE `mifostenant-ceda`.`client additional data` (
DROP TABLE IF EXISTS `client additional data`;
CREATE TABLE `client additional data` (
`client_id` bigint(20) NOT NULL,
`Gender_cd` int(11) NOT NULL,
`Date of Birth` date NOT NULL,
@@ -186,8 +186,8 @@ CREATE TABLE `mifostenant-ceda`.`client additional data` (
CONSTRAINT `FK_client_additional_data` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `mifostenant-ceda`.`impact measurement`;
CREATE TABLE `mifostenant-ceda`.`impact measurement` (
DROP TABLE IF EXISTS `impact measurement`;
CREATE TABLE `impact measurement` (
`loan_id` bigint(20) NOT NULL,
`YesNo_cd_RepaidOnSchedule` int(11) NOT NULL,
`ReasonNotRepaidOnSchedule` text DEFAULT NULL,
@@ -200,8 +200,8 @@ CREATE TABLE `mifostenant-ceda`.`impact measurement` (
CONSTRAINT `FK_impact measurement` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `mifostenant-ceda`.`loan additional data`;
CREATE TABLE `mifostenant-ceda`.`loan additional data` (
DROP TABLE IF EXISTS `loan additional data`;
CREATE TABLE `loan additional data` (
`loan_id` bigint(20) NOT NULL,
`PurposeOfLoan_cd` int(11) NOT NULL,
`CollateralType_cd` int(11) NOT NULL,
@@ -216,7 +216,7 @@ CREATE TABLE `mifostenant-ceda`.`loan additional data` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- datatables mapping
INSERT INTO `mifostenant-ceda`.`x_registered_table`
INSERT INTO `x_registered_table`
(`registered_table_name`,
`application_table_name`)
VALUES
@@ -244,9 +244,8 @@ from x_registered_table r;
-- ==== Chart of Accounts =====
DELETE FROM `mifostenant-ceda`.`acc_gl_account` WHERE id>0;
INSERT INTO `mifostenant-ceda`.`acc_gl_account` VALUES
truncate `acc_gl_account`;
INSERT INTO `acc_gl_account` VALUES
(1,'Petty Cash Balances',NULL,'11100',0,1,2,1,NULL),
(2,'Cash in Valut 1',NULL,'11101',0,1,1,1,NULL),
(3,'Bank Balances',NULL,'11200',0,1,2,1,NULL),
@@ -1,6 +1,6 @@
DELETE FROM `mifostenant-ceda`.`m_organisation_currency` WHERE id>0;
DELETE FROM `m_organisation_currency` WHERE id>0;
INSERT INTO `mifostenant-ceda`.`m_organisation_currency`
INSERT INTO `m_organisation_currency`
(
`code`,
`decimal_places`,
@@ -11,9 +11,9 @@ VALUES
('UGX', 2, 'Uganda Shilling', 'USh', 'currency.UGX');
UPDATE `mifostenant-ceda`.`m_appuser` SET `username` = 'admin' WHERE id=1;
UPDATE `m_appuser` SET `username` = 'admin' WHERE id=1;
INSERT INTO `mifostenant-ceda`.`m_appuser`
INSERT INTO `m_appuser`
(`is_deleted`,
`office_id`,
`username`,
@@ -30,12 +30,12 @@ VALUES
(0, 1, 'keithwoodlock', 'Keith', 'Woodlock',
'4f607e9b6cffbe7d3db92d4bfa3391c7aa751727b4ea29d08fddf9dd72e6e7e3', 'keithwoodlock@gmail.com', 0, 1, 1, 1, 1);
INSERT INTO `mifostenant-ceda`.`m_appuser_role`
INSERT INTO `m_appuser_role`
(`appuser_id`,`role_id`) VALUES (2,1);
UPDATE `mifostenant-ceda`.`m_office` SET `name` = 'CEDA Microfinance Ltd.' WHERE id=1;
UPDATE `m_office` SET `name` = 'CEDA Microfinance Ltd.' WHERE id=1;
INSERT INTO `mifostenant-ceda`.`m_office`
INSERT INTO `m_office`
(
`parent_id`,
`hierarchy`,
@@ -46,7 +46,7 @@ VALUES
(1, '.2.', 2, 'Uganda (Kampala)', '2009-01-01');
INSERT INTO `mifostenant-ceda`.`m_staff`
INSERT INTO `m_staff`
(
`is_loan_officer`,
`office_id`,
@@ -58,7 +58,7 @@ VALUES
(1, 2, 'Kampala', 'LoanOfficer', 'LoanOfficer, Kampala');
INSERT INTO `mifostenant-ceda`.`m_charge`
INSERT INTO `m_charge`
(
`name`,
`currency_code`,
@@ -72,7 +72,7 @@ INSERT INTO `mifostenant-ceda`.`m_charge`
VALUES ('Bank Fee (per installment)', 'UGX', 1, 2, 1, 1500.000000, 0, 1, 0);
INSERT INTO `mifostenant-ceda`.`m_product_loan`
INSERT INTO `m_product_loan`
(
`currency_code`,
`currency_digits`,
@@ -98,5 +98,5 @@ VALUES
24.000000, 3, 24.000000, 1, 1, 1, 2, 12, 1, 2, 2);
-- mapping of that loan product to GL Accounts
INSERT INTO `mifostenant-ceda`.`acc_product_mapping`
INSERT INTO `acc_product_mapping`
VALUES (1,4,1,1,1),(2,8,1,1,2),(3,34,1,1,3),(4,37,1,1,4),(5,35,1,1,5),(6,97,1,1,6);
File diff suppressed because one or more lines are too long
@@ -45,7 +45,4 @@ ADD CONSTRAINT `FK_disbursedon_userid` FOREIGN KEY (`disbursedon_userid`) REFERE
ALTER TABLE `m_loan`
ADD COLUMN `closedon_userid` BIGINT(20) DEFAULT NULL AFTER `closedon_date`,
ADD KEY `FK_closedon_userid` (`closedon_userid`),
ADD CONSTRAINT `FK_closedon_userid` FOREIGN KEY (`closedon_userid`) REFERENCES `m_appuser` (`id`);
ADD CONSTRAINT `FK_closedon_userid` FOREIGN KEY (`closedon_userid`) REFERENCES `m_appuser` (`id`);