
----------------------------------------------
-- Software Update date is 31-10-2023 Finished
----------------------------------------------
-- 09/11/2023 -- Md Mozahid Hossain
-- User role primary key id serial for USHA table & remaining. Example db is riseup db
-- Module primary key id does not maintain serial. Searial korte hobe & data thik korte hobe.

-- ALTER TABLE `gnl_user_permissions`
--     CHANGE `order_by` `order_by` VARCHAR(30) NULL DEFAULT NULL,
--     CHANGE `set_status` `set_status` VARCHAR(30) NULL DEFAULT NULL;

ALTER TABLE `gnl_sys_menus_actions`
    CHANGE `order_by` `order_by` VARCHAR(30) NULL DEFAULT NULL,
    CHANGE `set_status` `set_status` VARCHAR(30) NULL DEFAULT NULL;

-- UPDATE `gnl_user_permissions` SET `order_by`="100",`set_status`="100" WHERE `set_status` LIKE '8';
UPDATE `gnl_sys_menus_actions` SET `order_by`="100",`set_status`="100" WHERE `set_status` LIKE '8';
--- -- -- implement to all client database

-- Role table a role id gulo serial korte hobe, and serial korar por user table a role id change kore dite hobe

UPDATE `gnl_sys_user_roles` SET `id` = 2 WHERE `gnl_sys_user_roles`.`id` = 19;
UPDATE `gnl_sys_user_roles` SET `id` = 4 WHERE `gnl_sys_user_roles`.`id` = 27;
UPDATE `gnl_sys_user_roles` SET `id` = 5 WHERE `gnl_sys_user_roles`.`id` = 21;
UPDATE `gnl_sys_user_roles` SET `id` = 6 WHERE `gnl_sys_user_roles`.`id` = 22;

UPDATE `gnl_sys_user_roles` SET `parent_id` = 2 WHERE `gnl_sys_user_roles`.`parent_id` = 19;
UPDATE `gnl_sys_user_roles` SET `parent_id` = 4 WHERE `gnl_sys_user_roles`.`parent_id` = 27;
UPDATE `gnl_sys_user_roles` SET `parent_id` = 5 WHERE `gnl_sys_user_roles`.`parent_id` = 21;
UPDATE `gnl_sys_user_roles` SET `parent_id` = 6 WHERE `gnl_sys_user_roles`.`parent_id` = 22;

UPDATE `gnl_sys_users` SET `sys_user_role_id`=2 WHERE `sys_user_role_id` = 19;
UPDATE `gnl_sys_users` SET `sys_user_role_id`=4 WHERE `sys_user_role_id` = 27;
UPDATE `gnl_sys_users` SET `sys_user_role_id`=5 WHERE `sys_user_role_id` = 21;
UPDATE `gnl_sys_users` SET `sys_user_role_id`=6 WHERE `sys_user_role_id` = 22;

---------------------------- 3/12/2023 Md Mozahid
ALTER TABLE `gnl_companies`
    ADD `product_logo_lp` VARCHAR(250) NULL DEFAULT NULL AFTER `updated_by`,
    ADD `product_name_lp` VARCHAR(250) NULL AFTER `product_logo_lp`,
    ADD `product_logo_dash` VARCHAR(250) NULL AFTER `product_name_lp`,
    ADD `product_name_dash` VARCHAR(250) NULL AFTER `product_logo_dash`;

-----------------------
ALTER TABLE `gnl_companies`
  DROP `print_type`,
  DROP `return_policy_day`,
  DROP `max_bill_print`,
  DROP `vat`,
  DROP `fy_start_date`,
  DROP `fy_end_date`,
  DROP `processing_fee_editable`;

---------------------------- 26/12/2023 Raziul Islam
ALTER TABLE `gnl_terms_conditions` ADD `positionOrder` TINYINT(4) NULL DEFAULT NULL AFTER `tc_name`;
-- FOR OFFLINE
ALTER TABLE gnl_terms_conditions ADD COLUMN positionOrder TINYINT(4) NULL DEFAULT NULL;

---------------------------- 31/12/23 Tuli
ALTER TABLE `gnl_sys_modules`  ADD `order_by` INT NOT NULL DEFAULT '0'  AFTER `is_delete`;

-- Modify Date 06/11/2023 - By Md Mozahid Hossain

-- CREATE TABLE `gnl_sys_menus_actions` (
--   `id` int(11) NOT NULL,
--   `name` varchar(60) DEFAULT NULL,
--   `route_link` varchar(250) DEFAULT NULL,
--   `page_title` varchar(255) DEFAULT NULL,
--   `bn_name` varchar(255) DEFAULT NULL COMMENT 'Other language name',
--   `method_name` varchar(255) DEFAULT NULL,
--   `module_id` int(11) DEFAULT NULL,
--   `menu_id` int(20) DEFAULT NULL,
--   `order_by` int(2) DEFAULT NULL,
--   `set_status` int(2) DEFAULT NULL,
--   `notes` varchar(255) DEFAULT NULL,
--   `is_active` tinyint(2) NOT NULL DEFAULT '1' COMMENT 'here, 1 = active & 0 = in active',
--   `is_delete` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Here, 0 = do not delete record, 1 = delete record ',
--   `created_at` datetime DEFAULT NULL COMMENT 'record create date time 	',
--   `created_by` int(11) DEFAULT NULL COMMENT 'created by which user',
--   `updated_at` timestamp NULL DEFAULT NULL COMMENT 'record modified date time ',
--   `updated_by` int(11) DEFAULT NULL COMMENT 'modified by which user'
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ALTER TABLE `gnl_sys_menus_actions`
--   ADD PRIMARY KEY (`id`),
--   ADD KEY `menu_id` (`menu_id`);


-- ALTER TABLE `gnl_sys_menus_actions`
--   MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
-- COMMIT;

CREATE TABLE `gnl_sys_user_roles_permissions` (
  `role_id` int(11) DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  `menu_id` varchar(50) DEFAULT NULL,
  `action_id` varchar(50) DEFAULT NULL,
  `is_delete` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Here, 0 = do not delete record, 1 = delete record',
  `created_at` datetime DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

COMMIT;

