Commit df01c497 authored by Eric Dieckman's avatar Eric Dieckman
Browse files

Add initial data schema and contents

parent e9762fda
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -10,10 +10,12 @@

  <ItemGroup>
    <None Remove="scripts\20251023141300_InitialDatabase.sql" />
    <None Remove="scripts\20251027152500_InitialDataLoad.sql" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="scripts\20251023141300_InitialDatabase.sql" />
    <EmbeddedResource Include="scripts\20251027152500_InitialDataLoad.sql" />
  </ItemGroup>

  <ItemGroup>
+164 −1
Original line number Diff line number Diff line
@@ -8,4 +8,167 @@ CREATE TABLE `app_users` (
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`app_user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `access_domains` (
  `access_domain_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `manifest_uuid` varchar(100) DEFAULT NULL,
  `manifest_path` varchar(500) DEFAULT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`access_domain_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `areas` (
  `area_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`area_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `firewalls` (
  `firewall_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `notes` text,
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`firewall_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `locations` (
  `location_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `descr` varchar(255) DEFAULT NULL,
  `notes` text,
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `vlans` (
  `vlan_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `number` smallint unsigned NOT NULL,
  `area_id` bigint unsigned NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `descr` varchar(255) DEFAULT NULL,
  `notes` text,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`vlan_id`),
  KEY `vlans_areas_FK` (`area_id`),
  CONSTRAINT `vlans_areas_FK` FOREIGN KEY (`area_id`) REFERENCES `areas` (`area_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `subnets` (
  `subnet_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `cidr` varchar(100) DEFAULT NULL,
  `netname` varchar(100) DEFAULT NULL,
  `descr` varchar(255) DEFAULT NULL,
  `vlan_id` bigint unsigned NOT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`subnet_id`),
  KEY `subnets_vlans_FK` (`vlan_id`),
  CONSTRAINT `subnets_vlans_FK` FOREIGN KEY (`vlan_id`) REFERENCES `vlans` (`vlan_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `vsyses` (
  `vsys_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `firewall_id` bigint unsigned NOT NULL,
  `number` smallint unsigned NOT NULL,
  `descr` varchar(100) DEFAULT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`vsys_id`),
  KEY `vsyses_firewalls_FK` (`firewall_id`),
  CONSTRAINT `vsyses_firewalls_FK` FOREIGN KEY (`firewall_id`) REFERENCES `firewalls` (`firewall_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `wiscnic_groups` (
  `wiscnic_group_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nic_handle` varchar(100) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `descr` varchar(255) DEFAULT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`wiscnic_group_id`),
  UNIQUE KEY `wiscnic_groups_nic_handle_uniq` (`nic_handle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `people` (
  `person_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `nic_handle` varchar(100) NOT NULL,
  `netid` varchar(100) NOT NULL,
  `pvi` varchar(100) DEFAULT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`person_id`),
  UNIQUE KEY `wiscnic_people_netid_uniq` (`netid`),
  UNIQUE KEY `wiscnic_people_nic_handle_uniq` (`nic_handle`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `wiscnic_group_membership_types` (
  `wiscnic_group_membership_type_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  PRIMARY KEY (`wiscnic_group_membership_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `wiscnic_group_members` (
  `wiscnic_group_member_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `person_id` bigint unsigned NOT NULL,
  `wiscnic_group_membership_type_id` bigint unsigned NOT NULL,
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `wiscnic_group_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`wiscnic_group_member_id`),
  KEY `wiscnic_group_members_wiscnic_group_membership_types_FK` (`wiscnic_group_membership_type_id`),
  KEY `wiscnic_group_members_wiscnic_groups_FK` (`wiscnic_group_id`),
  KEY `wiscnic_group_members_people_FK` (`person_id`),
  CONSTRAINT `wiscnic_group_members_people_FK` FOREIGN KEY (`person_id`) REFERENCES `people` (`person_id`),
  CONSTRAINT `wiscnic_group_members_wiscnic_group_membership_types_FK` FOREIGN KEY (`wiscnic_group_membership_type_id`) REFERENCES `wiscnic_group_membership_types` (`wiscnic_group_membership_type_id`),
  CONSTRAINT `wiscnic_group_members_wiscnic_groups_FK` FOREIGN KEY (`wiscnic_group_id`) REFERENCES `wiscnic_groups` (`wiscnic_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `locations_vlans` (
  `location_vlan_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `location_id` bigint unsigned NOT NULL,
  `vlan_id` bigint unsigned NOT NULL,
  `is_active` tinyint unsigned NOT NULL DEFAULT (1),
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`location_vlan_id`),
  KEY `locations_vlans_locations_FK` (`location_id`),
  KEY `locations_vlans_vlans_FK` (`vlan_id`),
  CONSTRAINT `locations_vlans_locations_FK` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`),
  CONSTRAINT `locations_vlans_vlans_FK` FOREIGN KEY (`vlan_id`) REFERENCES `vlans` (`vlan_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `firewalls_vlans` (
  `firewall_vlan_id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `firewall_id` bigint unsigned NOT NULL,
  `vsys_id` bigint unsigned DEFAULT NULL,
  `vlan_id` bigint unsigned NOT NULL,
  `access_domain_id` bigint unsigned NOT NULL,
  `created_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  `updated_at` datetime NOT NULL DEFAULT (utc_timestamp()),
  PRIMARY KEY (`firewall_vlan_id`),
  KEY `firewalls_vlans_vlans_FK` (`vlan_id`),
  KEY `firewalls_vlans_vsyses_FK` (`vsys_id`),
  KEY `firewalls_vlans_access_domains_FK` (`access_domain_id`),
  KEY `firewalls_vlans_firewalls_FK` (`firewall_id`),
  CONSTRAINT `firewalls_vlans_access_domains_FK` FOREIGN KEY (`access_domain_id`) REFERENCES `access_domains` (`access_domain_id`),
  CONSTRAINT `firewalls_vlans_firewalls_FK` FOREIGN KEY (`firewall_id`) REFERENCES `firewalls` (`firewall_id`),
  CONSTRAINT `firewalls_vlans_vlans_FK` FOREIGN KEY (`vlan_id`) REFERENCES `vlans` (`vlan_id`),
  CONSTRAINT `firewalls_vlans_vsyses_FK` FOREIGN KEY (`vsys_id`) REFERENCES `vsyses` (`vsys_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+53 −0
Original line number Diff line number Diff line
INSERT INTO access_domains (access_domain_id,name,manifest_uuid,manifest_path,created_at,updated_at,is_active) VALUES
	 (1,'CALS','76c429a7ea354759848f9b1291828f79','uw:domain:firewall.net.wisc.edu:access_domains:CALS:Vsys-Admin-Role','2025-10-27 19:37:26','2025-10-27 19:37:26',1);
INSERT INTO areas (area_id,name,created_at,updated_at,is_active) VALUES
	 (1,'ANIMAL','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (2,'CSSC','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (3,'BORDER','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (4,'BACKBONE','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (5,'DDN','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (6,'432NM','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (7,'WIRELESS','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (8,'RBN','2025-10-27 19:27:07','2025-10-27 19:27:07',1),
	 (9,'LAB','2025-10-27 19:27:07','2025-10-27 19:27:07',1);
INSERT INTO firewalls (firewall_id,name,notes,created_at,updated_at) VALUES
	 (1,'Animal-Primary',NULL,'2025-10-27 19:37:51','2025-10-27 19:37:51');

INSERT INTO vlans (vlan_id,name,descr,notes,created_at,updated_at,`number`,area_id,is_active) VALUES
	 (2,'AG-AND-APPLIED-ECON_PRIVATE','Ag and Applied Economics Private FWSM network',NULL,'2025-10-27 19:29:30','2025-10-27 19:29:30',98,1,1);

INSERT INTO locations (location_id,name,descr,created_at,updated_at,notes) VALUES
	 (1,'Taylor Hall','427 Lorch St.','2025-10-27 19:11:33','2025-10-27 19:11:33',NULL);

INSERT INTO locations_vlans (location_vlan_id,location_id,vlan_id,created_at,updated_at,is_active) VALUES
	 (1,1,2,'2025-10-27 19:35:33','2025-10-27 19:35:33',1);

INSERT INTO subnets (subnet_id,cidr,netname,descr,created_at,updated_at,vlan_id,is_active) VALUES
	 (1,'144.92.122.0/24','AAE-LAN','Agricultural and Applied Economics','2025-10-27 19:33:24','2025-10-27 19:33:24',2,1),
	 (2,'2607:f388:108a::/64','AG_&_APPLIED_ECONOMICS','AG_&_APPLIED_ECONOMICS','2025-10-27 19:34:05','2025-10-27 19:34:05',2,1);

INSERT INTO vsyses (vsys_id,`number`,descr,created_at,updated_at,is_active,firewall_id) VALUES
	 (1,19,'CALS_ADMIN-ANIMAL','2025-10-27 19:39:43','2025-10-27 19:39:43',1,1);

INSERT INTO wiscnic_group_membership_types (wiscnic_group_membership_type_id,is_active,name) VALUES
	 (1,1,'Admin'),
	 (2,1,'Tech');

INSERT INTO wiscnic_groups (wiscnic_group_id,nic_handle,name,descr,is_active,created_at,updated_at) VALUES
	 (1,'CALS1-WISC','CALS_IT','College of Agricultural and Life Sciences IT',1,'2025-10-27 19:46:29','2025-10-27 19:46:29');

INSERT INTO people (person_id,name,email,nic_handle,netid,is_active,created_at,updated_at,pvi) VALUES
	 (1,'Eric Dieckman','	eric.dieckman@wisc.edu','ED2','ewdieckman',1,'2025-10-27 19:52:53','2025-10-27 19:52:53','UW106Z480'),
	 (2,'Jason Pursian','jason.pursian@wisc.edu','JP5','jpursian',1,'2025-10-27 19:58:03','2025-10-27 19:58:03','UW100D372'),
	 (3,'Thomas J Hartman','tjhartman@wisc.edu','TJH1-WISC','tjhartman',1,'2025-10-27 19:58:43','2025-10-27 19:58:43','UW323N583'),
	 (4,'Jordan Bauer','jordan.a.bauer@wisc.edu','JB18-WISC','jabauer2',1,'2025-10-27 19:59:16','2025-10-27 19:59:16','UW681L255');

INSERT INTO wiscnic_group_members (wiscnic_group_member_id,person_id,wiscnic_group_membership_type_id,created_at,wiscnic_group_id) VALUES
	 (1,1,1,'2025-10-27 20:02:59',1),
	 (2,2,1,'2025-10-27 20:02:59',1),
	 (3,3,1,'2025-10-27 20:02:59',1),
	 (4,4,2,'2025-10-27 20:02:59',1);


INSERT INTO firewalls_vlans (firewall_vlan_id,firewall_id,vsys_id,vlan_id,access_domain_id,created_at,updated_at) VALUES
	 (1,1,1,2,1,'2025-10-27 19:40:41','2025-10-27 19:40:41');