blob: e624a96206df524a98dfe531b353fc1949e27420 [file] [log] [blame]
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
CREATE TABLE `m_family_members` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`client_id` BIGINT NOT NULL,
`firstname` varchar(50) NOT NULL,
`middlename` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`qualification` varchar(50) DEFAULT NULL,
`relationship_cv_id` INT NOT NULL,
`marital_status_cv_id` INT DEFAULT NULL,
`gender_cv_id` INT DEFAULT NULL,
`date_of_birth` date DEFAULT NULL,
`age` INT DEFAULT NULL,
`profession_cv_id` INT DEFAULT NULL,
`mobile_number` varchar(50) DEFAULT NULL,
`is_dependent` TINYINT DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_m_family_members_client_id_m_client` (`client_id`),
KEY `FK_m_family_members_relationship_m_code_value` (`relationship_cv_id`),
KEY `FK_m_family_members_marital_status_m_code_value` (`marital_status_cv_id`),
KEY `FK_m_family_members_gender_m_code_value` (`gender_cv_id`),
KEY `FK_m_family_members_profession_m_code_value` (`profession_cv_id`),
CONSTRAINT `FK_m_family_members_client_id_m_client` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_family_members_gender_m_code_value` FOREIGN KEY (`gender_cv_id`) REFERENCES `m_code_value` (`id`),
CONSTRAINT `FK_m_family_members_marital_status_m_code_value` FOREIGN KEY (`marital_status_cv_id`) REFERENCES `m_code_value` (`id`),
CONSTRAINT `FK_m_family_members_profession_m_code_value` FOREIGN KEY (`profession_cv_id`) REFERENCES `m_code_value` (`id`),
CONSTRAINT `FK_m_family_members_relationship_m_code_value` FOREIGN KEY (`relationship_cv_id`) REFERENCES `m_code_value` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8MB4;
-- permissions
INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'CREATE_FAMILYMEMBERS', 'FAMILYMEMBERS', 'CREATE', 0);
INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'UPDATE_FAMILYMEMBERS', 'FAMILYMEMBERS', 'UPDATE', 0);
INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'DELETE_FAMILYMEMBERS', 'FAMILYMEMBERS', 'DELETE', 0);
-- code inserts
INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('MARITAL STATUS', 1);
INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('RELATIONSHIP', 1);
INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('PROFESSION', 1);