
-- CREATE TABLE `users` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`name` VARCHAR(191) NOT NULL COLLATE 'utf8_general_ci',
-- 	`email` VARCHAR(191) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`user_type` ENUM('Admin','User') NULL DEFAULT 'User' COLLATE 'utf8mb4_unicode_ci',
-- 	`role_id` INT(11) NULL DEFAULT NULL,
-- 	`team_id` INT(11) NULL DEFAULT NULL,
-- 	`designation_id` INT(11) NULL DEFAULT NULL,
-- 	`user_id` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`refer_id` INT(11) NULL DEFAULT '0',
-- 	`status` TINYINT(4) NULL DEFAULT '0',
-- 	`father_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`mother_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`nominee_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`relation_with_nominee` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`profession` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`nid_no` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`birth_certificate_no` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`picture` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`phone_number` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`phone2` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`date_of_birth` DATE NULL DEFAULT NULL,
-- 	`gender` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`religion` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`blood_group` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`address` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`district_id` INT(11) NULL DEFAULT NULL,
-- 	`thana_id` INT(11) NULL DEFAULT NULL,
-- 	`union_id` INT(11) NULL DEFAULT NULL,
-- 	`email_verified_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`password` VARCHAR(191) NOT NULL COLLATE 'utf8_general_ci',
-- 	`remember_token` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`present_address_district` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`present_address_thana` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`present_address_union` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`present_address_word` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`present_address` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`parmanent_address_district` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`parmanent_address_thana` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`parmanent_address_union` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`parmanent_address_word` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`parmanent_address` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`office_address_district` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`office_address_thana` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`office_address_union` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`office_address_word` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	`office_address` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
-- 	PRIMARY KEY (`id`) USING BTREE,
-- 	UNIQUE INDEX `user_id` (`user_id`) USING BTREE
-- )
-- COLLATE='utf8mb4_unicode_ci'
-- ENGINE=InnoDB
-- AUTO_INCREMENT=4964
-- ;

-- ALTER TABLE `users`
-- 	CHANGE COLUMN `address` `present_address` TEXT NULL COLLATE 'utf8mb4_unicode_ci' AFTER `blood_group`,
-- 	ADD COLUMN `present_address_district` INT NULL DEFAULT NULL AFTER `present_address`,
-- 	ADD COLUMN `present_address_thana` INT NULL DEFAULT NULL AFTER `present_address_district`,
-- 	ADD COLUMN `present_address_union` INT NULL DEFAULT NULL AFTER `present_address_thana`,
-- 	ADD COLUMN `present_address_word` INT NULL DEFAULT NULL AFTER `present_address_union`,
-- 	ADD COLUMN `parmanent_address` TEXT NULL AFTER `present_address_word`,
-- 	CHANGE COLUMN `district_id` `parmanent_address_district` INT(11) NULL DEFAULT NULL AFTER `parmanent_address`,
-- 	CHANGE COLUMN `thana_id` `parmanent_address_thana` INT(11) NULL DEFAULT NULL AFTER `parmanent_address_district`,
-- 	CHANGE COLUMN `union_id` `parmanent_address_union` INT(11) NULL DEFAULT NULL AFTER `parmanent_address_thana`,
-- 	ADD COLUMN `parmanent_address_word` INT(11) NULL DEFAULT NULL AFTER `parmanent_address_union`,
-- 	ADD COLUMN `office_address` TEXT NULL DEFAULT NULL AFTER `parmanent_address_word`,
-- 	ADD COLUMN `office_address_district` INT NULL DEFAULT NULL AFTER `office_address`,
-- 	ADD COLUMN `office_address_thana` INT NULL DEFAULT NULL AFTER `office_address_district`,
-- 	ADD COLUMN `office_address_union` INT NULL DEFAULT NULL AFTER `office_address_thana`,
-- 	ADD COLUMN `office_address_word` INT NULL DEFAULT NULL AFTER `office_address_union`;

-- ALTER TABLE `words`
-- 	CHANGE COLUMN `thana_id` `union_id` INT(11) NULL DEFAULT NULL AFTER `id`;

-- ALTER TABLE `users`
-- 	ADD COLUMN `old_id` INT NULL DEFAULT NULL AFTER `name`;


-- ALTER TABLE `users`
-- 	COLLATE='utf8_general_ci',
-- 	CONVERT TO CHARSET utf8;
	
-- ALTER TABLE `users`
-- 	ADD COLUMN `remarks` TEXT NULL DEFAULT NULL AFTER `blood_group`;

-- CREATE TABLE `manager_groups` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`group_id` INT(11) NULL DEFAULT NULL,
-- 	`user_id` INT(11) NULL DEFAULT NULL,
-- 	`created_by` INT(11) NULL DEFAULT NULL,
-- 	`updated_by` INT(11) NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`)
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- CREATE TABLE `group_user_remarks` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`group_user_id` INT(11) NULL DEFAULT NULL,
-- 	`remarks` TEXT NULL,
-- 	`created_by` INT(11) NULL DEFAULT NULL,
-- 	`updated_by` INT(11) NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`)
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;


-- CREATE TABLE `activity_logs` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`module_type` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`module_id` INT(11) NULL DEFAULT NULL,
-- 	`summary` VARCHAR(150) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`text` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`action` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_by` INT(11) NULL DEFAULT NULL,
-- 	`updated_by` INT(11) NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- CREATE TABLE `users_phone` ( 
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 
-- 	`user_id` INT NOT NULL,
-- 	`phone_type` VARCHAR(100) NOT NULL,
-- 	`phone_number` VARCHAR(100) NOT NULL,
-- 	`created_at` TIMESTAMP NOT NULL,
-- 	`updated_at` TIMESTAMP NOT NULL,
-- 	PRIMARY KEY (`id`)
-- 	)
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;


-- CREATE TABLE `users_social_profiles` (
-- 	`id` INT UNSIGNED NOT NULL AUTO_INCREMENT , 
-- 	`user_id` INT UNSIGNED NOT NULL , 
-- 	`profile_type` VARCHAR(100) NOT NULL , 
-- 	`profile_url` VARCHAR(150) NOT NULL , 
-- 	`created_at` TIMESTAMP NOT NULL , 
-- 	`updated_at` TIMESTAMP NOT NULL , 
-- 	PRIMARY KEY (`id`)
-- 	) 
-- 	COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- CREATE TABLE `all_types` ( 
-- 	`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
-- 	`name` VARCHAR(100) NOT NULL , 
-- 	`type` VARCHAR(100) NOT NULL , 
-- 	`created_at` TIMESTAMP NOT NULL , 
-- 	`updated_at` TIMESTAMP NOT NULL , 
-- 	PRIMARY KEY (`id`)
-- 	)
-- 	COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- ALTER TABLE `activity_logs`
-- 	ADD COLUMN `member_id` INT(11) NULL DEFAULT NULL AFTER `module_id`;
	
-- ALTER TABLE `users_phone`
-- 	CHANGE COLUMN `user_id` `user_id` INT(11) NULL DEFAULT NULL AFTER `id`,
-- 	CHANGE COLUMN `phone_type` `phone_type_id` INT NULL DEFAULT NULL AFTER `user_id`,
-- 	CHANGE COLUMN `phone_number` `phone_number` VARCHAR(100) NULL DEFAULT NULL AFTER `phone_type_id`,
-- 	CHANGE COLUMN `created_at` `created_at` TIMESTAMP NULL DEFAULT NULL AFTER `phone_number`,
-- 	CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NULL DEFAULT NULL AFTER `created_at`;

-- CREATE TABLE `users_phone_accounts` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`user_id` INT(11) NULL DEFAULT NULL,
-- 	`user_phone_id` INT(11) NULL DEFAULT NULL,
-- 	`phone_account_id` INT(11) NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`)
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- ALTER TABLE `users_phone_accounts`
-- 	ADD COLUMN `created_by` INT(11) NULL DEFAULT NULL AFTER `phone_account_id`,
-- 	ADD COLUMN `updated_by` INT(11) NULL DEFAULT NULL AFTER `created_by`;

-- ALTER TABLE `users_phone`
-- 	ADD COLUMN `created_by` INT NULL DEFAULT NULL AFTER `phone_number`,
-- 	ADD COLUMN `updated_by` INT NULL DEFAULT NULL AFTER `created_by`;

-- ALTER TABLE `users_social_profiles`
-- 	CHANGE COLUMN `user_id` `user_id` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `id`,
-- 	CHANGE COLUMN `profile_type` `profile_type_id` INT NULL DEFAULT NULL AFTER `user_id`,
-- 	CHANGE COLUMN `profile_url` `profile_url` VARCHAR(150) NULL DEFAULT NULL AFTER `profile_type_id`,
-- 	ADD COLUMN `created_by` INT NULL DEFAULT NULL AFTER `profile_url`,
-- 	ADD COLUMN `updated_by` INT NULL DEFAULT NULL AFTER `created_by`,
-- 	CHANGE COLUMN `created_at` `created_at` TIMESTAMP NULL DEFAULT NULL AFTER `updated_by`,
-- 	CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NULL DEFAULT NULL AFTER `created_at`;


-- CREATE TABLE `products` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`code` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`price` DOUBLE NULL DEFAULT NULL,
-- 	`product_image` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_at` TIMESTAMP NOT NULL,
-- 	`updated_at` TIMESTAMP NOT NULL,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- AUTO_INCREMENT=6
-- ;

-- ALTER TABLE `products`
-- 	CHANGE COLUMN `price` `price` DECIMAL(10,2) NULL DEFAULT '0' AFTER `code`;

-- ALTER TABLE `products`
-- 	ADD COLUMN `description` LONGTEXT NULL DEFAULT NULL AFTER `name`,
-- 	ADD COLUMN `unit` VARCHAR(50) NULL DEFAULT NULL AFTER `price`,
-- 	ADD COLUMN `category_id` INT NULL DEFAULT NULL AFTER `unit`,
-- 	ADD COLUMN `group_id` INT NULL DEFAULT NULL AFTER `category_id`,
-- 	CHANGE COLUMN `product_image` `product_image` VARCHAR(150) NULL DEFAULT NULL COLLATE 'utf8_general_ci' AFTER `group_id`,
-- 	ADD COLUMN `minimum_stock` INT NULL DEFAULT '0' AFTER `product_image`,
-- 	ADD COLUMN `reorder_quantity` INT NULL DEFAULT '0' AFTER `minimum_stock`,
-- 	ADD COLUMN ` status` VARCHAR(120) NULL DEFAULT 'active' AFTER `reorder_quantity`,
-- 	ADD COLUMN `product_in` INT NULL DEFAULT '0' AFTER ` status`,
-- 	ADD COLUMN `product_out` INT NULL DEFAULT '0' AFTER `product_in`;


-- CREATE TABLE `product_group` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`group_name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- RENAME TABLE `category` TO `product_category`;

-- ALTER TABLE `group_user_remarks`
-- 	ADD COLUMN `group_id` INT(11) NULL DEFAULT NULL AFTER `group_user_id`;
-- ALTER TABLE `users`
-- 	ADD COLUMN `biodata` VARCHAR(50) NULL DEFAULT NULL AFTER `remarks`;


-- CREATE TABLE `purchase` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;


-- CREATE TABLE `purchase` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`member_id` INT(10) NULL DEFAULT NULL,
-- 	`purchase_no` VARCHAR(120) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`purchase_date` TIMESTAMP NULL DEFAULT NULL,
-- 	`due_date` TIMESTAMP NULL DEFAULT NULL,
-- 	`branch_id` INT(11) NULL DEFAULT NULL,
-- 	`refer_type` TINYINT(4) NULL DEFAULT NULL,
-- 	`refer_id` INT(11) NULL DEFAULT NULL,
-- 	`grand_total` DOUBLE NULL DEFAULT '0',
-- 	`net_total` DOUBLE NULL DEFAULT '0',
-- 	`discount` DOUBLE NULL DEFAULT '0',
-- 	`note` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_by` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_by` TIMESTAMP NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;


-- CREATE TABLE `purchase_details` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`purchase_id` INT(11) NULL DEFAULT NULL,
-- 	`product_id` INT(11) NULL DEFAULT NULL,
-- 	`quantity` INT(11) NULL DEFAULT '0',
-- 	`price` DOUBLE NULL DEFAULT '0',
-- 	`total` DOUBLE NULL DEFAULT '0',
-- 	`discount` DOUBLE NULL DEFAULT '0',
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;
-- ALTER TABLE `group_user_remarks`
-- 	ADD COLUMN `file` VARCHAR(50) NULL DEFAULT NULL AFTER `remarks`;	

-- ALTER TABLE `group_user_remarks`
-- 	CHANGE COLUMN `file` `file` VARCHAR(50) NULL DEFAULT NULL AFTER `remarks`;


-- ALTER TABLE `purchase`
-- 	CHANGE COLUMN `created_by` `created_by` INT NULL DEFAULT NULL AFTER `note`,
-- 	CHANGE COLUMN `updated_by` `updated_by` INT NULL DEFAULT NULL AFTER `created_by`;

-- ALTER TABLE `purchase`
-- 	ADD COLUMN `status` BOOLEAN DEFAULT '0' AFTER `note`;

-- CREATE TABLE `stockitems` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`product_id` INT(11) NULL DEFAULT NULL,
-- 	`quantity` INT(11) NULL DEFAULT NULL,
-- 	`purchase_price` DOUBLE NULL DEFAULT '0',
-- 	`sell_price` DOUBLE NULL DEFAULT '0',
-- 	`status` VARCHAR(50) NULL DEFAULT 'purchase',
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- CREATE TABLE `sells` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`member_id` INT(10) NULL DEFAULT NULL,
-- 	`sell_no` VARCHAR(120) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`sell_date` TIMESTAMP NULL DEFAULT NULL,
-- 	`due_date` TIMESTAMP NULL DEFAULT NULL,
-- 	`branch_id` INT(11) NULL DEFAULT NULL,
-- 	`refer_type` TINYINT(4) NULL DEFAULT NULL,
-- 	`refer_id` INT(11) NULL DEFAULT NULL,
-- 	`grand_total` DOUBLE NULL DEFAULT '0',
-- 	`net_total` DOUBLE NULL DEFAULT '0',
-- 	`discount` DOUBLE NULL DEFAULT '0',
-- 	`note` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
-- 	`created_by` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_by` TIMESTAMP NULL DEFAULT NULL,
-- 	`created_at` TIMESTAMP NULL DEFAULT NULL,
-- 	`updated_at` TIMESTAMP NULL DEFAULT NULL,
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;
-- CREATE TABLE `sells_details` (
-- 	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- 	`sells_id` INT(11) NULL DEFAULT NULL,
-- 	`product_id` INT(11) NULL DEFAULT NULL,
-- 	`quantity` INT(11) NULL DEFAULT '0',
-- 	`price` DOUBLE NULL DEFAULT '0',
-- 	`total` DOUBLE NULL DEFAULT '0',
-- 	`discount` DOUBLE NULL DEFAULT '0',
-- 	PRIMARY KEY (`id`) USING BTREE
-- )
-- COLLATE='utf8_general_ci'
-- ENGINE=InnoDB
-- ;

-- ALTER TABLE `products`
-- 	CHANGE COLUMN `description` `description` LONGTEXT NULL DEFAULT NULL AFTER `name`,
-- 	CHANGE COLUMN `created_at` `created_at` TIMESTAMP NULL DEFAULT NULL AFTER `product_out`,
-- 	CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NULL DEFAULT NULL AFTER `created_at`;
-- ALTER TABLE `products`
-- 	CHANGE COLUMN ` status` `status` ENUM('Active','Inactive') NULL DEFAULT 'Active' AFTER `reorder_quantity`;

-- ALTER TABLE `all_types`
-- 	ADD COLUMN `icon` TEXT NULL DEFAULT NULL AFTER `type`;
	
-- ALTER TABLE `users`
-- 	CHANGE COLUMN `biodata` `biodata` LONGTEXT NULL DEFAULT NULL AFTER `remarks`;
-- ALTER TABLE `groups`
-- 	ADD COLUMN `parent_id` INT(11) NULL DEFAULT '0' AFTER `creator_id`;

CREATE TABLE `sells` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`member_id` INT(10) NULL DEFAULT NULL,
	`sell_no` VARCHAR(120) NULL DEFAULT NULL,
	`sell_date` TIMESTAMP NULL DEFAULT NULL,
	`due_date` TIMESTAMP NULL DEFAULT NULL,
	`branch_id` INT(11) NULL DEFAULT NULL,
	`refer_type` TINYINT(4) NULL DEFAULT NULL,
	`refer_id` INT(11) NULL DEFAULT NULL,
	`grand_total` DOUBLE NULL DEFAULT '0',
	`net_total` DOUBLE NULL DEFAULT '0',
	`discount` DOUBLE NULL DEFAULT '0',
	`note` VARCHAR(100) NULL DEFAULT NULL,
	`created_by` TIMESTAMP NULL DEFAULT NULL,
	`updated_by` TIMESTAMP NULL DEFAULT NULL,
	`created_at` TIMESTAMP NULL DEFAULT NULL,
	`updated_at` TIMESTAMP NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;
CREATE TABLE `sells_details` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`sells_id` INT(11) NULL DEFAULT NULL,
	`product_id` INT(11) NULL DEFAULT NULL,
	`quantity` INT(11) NULL DEFAULT '0',
	`price` DOUBLE NULL DEFAULT '0',
	`total` DOUBLE NULL DEFAULT '0',
	`discount` DOUBLE NULL DEFAULT '0',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;

CREATE TABLE `stockitems` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`product_id` INT(11) NULL DEFAULT NULL,
	`quantity` INT(11) NULL DEFAULT NULL,
	`purchase_price` DOUBLE NULL DEFAULT '0',
	`sell_price` DOUBLE NULL DEFAULT '0',
	`status` VARCHAR(50) NULL DEFAULT 'purchase',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;
CREATE TABLE `purchase` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`member_id` INT(10) NULL DEFAULT NULL,
	`purchase_no` VARCHAR(120) NULL DEFAULT NULL,
	`purchase_date` TIMESTAMP NULL DEFAULT NULL,
	`due_date` TIMESTAMP NULL DEFAULT NULL,
	`branch_id` INT(11) NULL DEFAULT NULL,
	`refer_type` TINYINT(4) NULL DEFAULT NULL,
	`refer_id` INT(11) NULL DEFAULT NULL,
	`grand_total` DOUBLE NULL DEFAULT '0',
	`net_total` DOUBLE NULL DEFAULT '0',
	`discount` DOUBLE NULL DEFAULT '0',
	`note` VARCHAR(100) NULL DEFAULT NULL,
	`created_by` INT(11) NULL DEFAULT NULL,
	`updated_by` INT(11) NULL DEFAULT NULL,
	`created_at` TIMESTAMP NULL DEFAULT NULL,
	`updated_at` TIMESTAMP NULL DEFAULT NULL,
	`status` TINYINT(1) NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;
CREATE TABLE `purchase_details` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`purchase_id` INT(11) NULL DEFAULT NULL,
	`product_id` INT(11) NULL DEFAULT NULL,
	`quantity` INT(11) NULL DEFAULT '0',
	`price` DOUBLE NULL DEFAULT '0',
	`total` DOUBLE NULL DEFAULT '0',
	`discount` DOUBLE NULL DEFAULT '0',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;





CREATE TABLE `user_documents` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`user_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`document_type_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`file` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
	`note` TEXT NULL DEFAULT NULL COLLATE 'utf8_general_ci',
	`created_by` INT(10) NULL DEFAULT NULL,
	`updated_by` INT(10) NULL DEFAULT NULL,
	`created_at` TIMESTAMP NULL DEFAULT NULL,
	`updated_at` TIMESTAMP NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;


CREATE TABLE `short_remarks` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(150) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
	`created_by` INT(10) NULL DEFAULT NULL,
	`updated_by` INT(10) NULL DEFAULT NULL,
	`created_at` TIMESTAMP NULL DEFAULT NULL,
	`updated_at` TIMESTAMP NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;

ALTER TABLE `group_user_remarks`
	ADD COLUMN `short_remarks_id` INT(11) NULL DEFAULT NULL AFTER `group_user_id`;

ALTER TABLE `stockitems`
	CHANGE COLUMN `status` `status` ENUM('purchase','sell') NULL DEFAULT NULL COLLATE 'utf8_general_ci' AFTER `sell_price`;


ALTER TABLE `stockitems`
	ADD COLUMN `purchase_at` DATETIME NULL DEFAULT NULL AFTER `purchase_price`,
	ADD COLUMN `sell_at` DATETIME NULL DEFAULT NULL AFTER `sell_price`,
	ADD COLUMN `updated_at` DATETIME NULL DEFAULT NULL AFTER `status`;
ALTER TABLE `stockitems`
	CHANGE COLUMN `status` `status` ENUM('purchase','sell') NULL DEFAULT 'purchase' COLLATE 'utf8_general_ci' AFTER `sell_at`;
ALTER TABLE `groups`
	ADD COLUMN `parent_id` INT(11) NULL DEFAULT '0' AFTER `creator_id`;


CREATE TABLE `user_relatives` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`member_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`relative_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`note` TEXT NULL DEFAULT NULL COLLATE 'utf8_general_ci',
	`created_at` DATETIME NULL DEFAULT NULL,
	`updated_at` DATETIME NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;

CREATE TABLE `packages` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`package_name` VARCHAR(250) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
	`profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`term_of_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_one_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_one_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_two_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_two_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_three_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_three_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`status` ENUM('Active','Inactive') NULL DEFAULT 'Active' COLLATE 'utf8_general_ci',
	`created_by` INT(11) NULL DEFAULT NULL,
	`updated_by` INT(11) NULL DEFAULT NULL,
	`created_at` DATETIME NULL DEFAULT NULL,
	`updated_at` DATETIME NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;
CREATE TABLE `investments` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`user_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`amount` INT(10) UNSIGNED NULL DEFAULT NULL,
	`invest_date` DATETIME NULL DEFAULT NULL,
	`package_id` INT(10) NULL DEFAULT NULL,
	`profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`term_of_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_one_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_one_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_two_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_two_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_three_profit_ratio` INT(10) UNSIGNED NULL DEFAULT NULL,
	`closing_three_month` INT(10) UNSIGNED NULL DEFAULT NULL,
	`agent_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`gm_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`mm_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`zm_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`am_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`sa_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`ma_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`ca_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`pa_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`status` TINYINT(4) NULL DEFAULT '1',
	`created_by` INT(11) NULL DEFAULT NULL,
	`updated_by` INT(11) NULL DEFAULT NULL,
	`created_at` DATETIME NULL DEFAULT NULL,
	`updated_at` DATETIME NULL DEFAULT NULL,
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;

