/home/ejrndhmu/.trash/add_custom_menu_table.sql.2
-- Tabel untuk menyimpan menu sidebar custom
CREATE TABLE IF NOT EXISTS `custom_sidebar_menus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL,
`icon` varchar(50) NOT NULL DEFAULT 'fas fa-link',
`url` varchar(255) NOT NULL,
`target_panel` enum('user','reseller','both') NOT NULL DEFAULT 'both',
`is_active` tinyint(1) NOT NULL DEFAULT 1,
`sort_order` int(11) NOT NULL DEFAULT 0,
`created_by` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_target_panel` (`target_panel`),
KEY `idx_is_active` (`is_active`),
KEY `idx_sort_order` (`sort_order`),
KEY `fk_created_by` (`created_by`),
CONSTRAINT `fk_custom_menu_created_by` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Insert beberapa contoh menu default
INSERT INTO `custom_sidebar_menus` (`title`, `icon`, `url`, `target_panel`, `is_active`, `sort_order`, `created_by`) VALUES
('Tutorial', 'fas fa-book', 'https://example.com/tutorial', 'both', 1, 1, 1),
('Support', 'fas fa-headset', 'https://example.com/support', 'both', 1, 2, 1),
('FAQ', 'fas fa-question-circle', 'https://example.com/faq', 'user', 1, 3, 1);