--
-- Host: localhost    Database: network_panel
-- ------------------------------------------------------


--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `action` varchar(255) NOT NULL,
  `details` text DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `activity_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `activity_logs`
--

INSERT INTO `activity_logs` VALUES
(1,1,'Logged in','','2025-11-13 11:39:10'),
(2,1,'Logged out','','2025-11-13 11:49:12'),
(3,3,'Logged in','','2025-11-13 11:49:20'),
(4,3,'Added user','User ID: 4, Username: test','2025-11-13 11:55:51'),
(5,3,'Deleted user','User ID: 4','2025-11-13 11:56:04'),
(6,3,'Deleted device','Device ID: 4','2025-11-13 12:07:29'),
(7,3,'Deleted server','Server ID: 2, Label: test','2025-11-13 12:14:11'),
(8,3,'Added user','User ID: 5, Username: test','2025-11-13 12:14:51'),
(9,3,'Deleted user','User ID: 5, Username: test','2025-11-13 12:14:55'),
(10,1,'Failed login attempt','Bad password for username: admin','2025-11-13 13:03:50'),
(11,1,'Logged in','','2025-11-13 13:03:59'),
(12,1,'Logged in','','2025-11-13 15:20:39'),
(13,1,'Logged out','from IP: 134.199.25.73','2025-11-13 15:49:21'),
(14,3,'Logged in','from IP: 134.199.25.73','2025-11-13 15:49:28'),
(15,3,'Tested device connection','Device ID: 3, Name: TPA01-2-2-3-SW01, Result: Connection to TPA01-2-2-3-SW01 (10.33.0.131) successful.','2025-11-13 16:37:41'),
(16,3,'Logged in','from IP: 134.199.25.73','2025-11-13 17:33:05'),
(17,3,'Queried IPs','For device ID: 3','2025-11-13 17:41:53'),
(18,3,'Queried IPs','For device ID: 3','2025-11-13 17:43:30'),
(19,3,'Edited device','Device ID: 3, Name: TPA01-2-2-3-SW01','2025-11-13 17:48:22'),
(20,3,'Tested device connection','Device ID: 3, Name: TPA01-2-2-3-SW01, Result: Connection to TPA01-2-2-3-SW01 (10.33.0.131) failed: ','2025-11-13 17:48:28'),
(21,3,'Tested device connection','Device ID: 3, Name: TPA01-2-2-3-SW01, Result: Connection to TPA01-2-2-3-SW01 (10.33.0.131) successful.','2025-11-13 17:48:46'),
(22,3,'Queried IPs','For device ID: 3','2025-11-13 17:48:55'),
(23,3,'Queried IPs','For device ID: 3','2025-11-13 17:49:51'),
(24,3,'Queried IPs','For device ID: 3','2025-11-13 18:07:01'),
(25,3,'Queried IPs','For device ID: 3','2025-11-13 18:08:41'),
(26,3,'Queried IPs','For device ID: 3','2025-11-13 18:12:03'),
(27,3,'Queried IPs','For device ID: 3','2025-11-13 18:17:40'),
(28,3,'Queried IPs','For device ID: 3','2025-11-13 18:24:25'),
(29,3,'Queried IPs','For device ID: 3','2025-11-13 18:37:16'),
(30,3,'Queried IPs','For device ID: 3','2025-11-13 18:50:17'),
(31,3,'Queried IPs','For device ID: 3','2025-11-13 18:53:16'),
(32,3,'Queried IPs','For device ID: 3','2025-11-13 18:53:38'),
(33,3,'Queried IPs','For device ID: 3','2025-11-13 18:54:50'),
(34,3,'Queried IPs','For device ID: 3','2025-11-13 18:58:47'),
(35,3,'Queried IPs','For device ID: 3','2025-11-13 19:09:44'),
(36,3,'Queried IPs','For device ID: 3','2025-11-13 19:21:53'),
(37,3,'Queried IPs','For device ID: 3','2025-11-13 19:26:49'),
(38,3,'Queried IPs','For device ID: 3','2025-11-13 19:27:12'),
(39,3,'Queried IPs','For device ID: 3','2025-11-13 19:31:31'),
(40,3,'Queried IPs','For device ID: 3','2025-11-13 19:34:35'),
(41,3,'Queried IPs','For device ID: 3','2025-11-13 19:37:31'),
(42,3,'Queried IPs','For device ID: 3','2025-11-13 19:37:43'),
(43,3,'Queried IPs','For device ID: 3','2025-11-13 19:37:50'),
(44,3,'Queried IPs','For device ID: 3','2025-11-13 19:37:58'),
(45,3,'Queried IPs','For device ID: 3','2025-11-13 19:38:04'),
(46,3,'Queried IPs','For device ID: 3','2025-11-13 19:38:10');

--
-- Table structure for table `ips`
--

CREATE TABLE `ips` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `device_id` int(11) DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `type` enum('IPv4','IPv6') DEFAULT NULL,
  `is_static` tinyint(1) DEFAULT NULL,
  `vlan_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `device_id` (`device_id`),
  CONSTRAINT `ips_ibfk_1` FOREIGN KEY (`device_id`) REFERENCES `devices` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `ips`
--


--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `permissions` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` VALUES
(1,'Admin','all');

--
-- Table structure for table `servers`
--

CREATE TABLE `servers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `label` varchar(100) NOT NULL,
  `ip` varchar(45) NOT NULL,
  `vlan_id` int(11) NOT NULL,
  `switch_name` varchar(100) NOT NULL,
  `switch_port` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `servers`
--

INSERT INTO `servers` VALUES
(1,'TPA1144','38.57.3.246',101,'TPA01-2-2-3-SW01','ge-0/0/1');


