CREATE TABLE `bookings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) unsigned DEFAULT NULL,
  `pcrpanel_id` bigint(20) unsigned DEFAULT NULL,
  `contract` varchar(255) DEFAULT NULL,
  `purchase_date` timestamp NULL DEFAULT NULL,
  `count` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `billed` tinyint(1) DEFAULT NULL,
  `paid` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `configitems` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `configkey` varchar(255) NOT NULL,
  `configvalue` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `customers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` tinytext NOT NULL,
  `address` tinytext NOT NULL,
  `address2` tinytext DEFAULT NULL,
  `zip` tinytext NOT NULL,
  `country` tinytext DEFAULT NULL,
  `town` tinytext NOT NULL,
  `phone` tinytext DEFAULT NULL,
  `email` tinytext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `custno` varchar(255) DEFAULT NULL,
  `name2` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `imported_rows` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `runfile` varchar(255) DEFAULT NULL,
  `well` varchar(255) DEFAULT NULL,
  `samplename` varchar(255) DEFAULT NULL,
  `targetname` varchar(250) DEFAULT NULL,
  `task` varchar(250) DEFAULT NULL,
  `reporter` varchar(250) DEFAULT NULL,
  `quencher` varchar(250) DEFAULT NULL,
  `ct` varchar(250) DEFAULT NULL,
  `ct_mean` varchar(250) DEFAULT NULL,
  `ct_sd` varchar(250) DEFAULT NULL,
  `quantity_mean` varchar(250) DEFAULT NULL,
  `quantity_sd` varchar(250) DEFAULT NULL,
  `automatic_ct_treshold` varchar(250) DEFAULT NULL,
  `ct_treshold` varchar(250) DEFAULT NULL,
  `automatic_baseline` varchar(250) DEFAULT NULL,
  `baseline_start` varchar(250) DEFAULT NULL,
  `baseline_end` varchar(250) DEFAULT NULL,
  `comments` varchar(250) DEFAULT NULL,
  `HIGHSD` varchar(250) DEFAULT NULL,
  `NOAMP` varchar(250) DEFAULT NULL,
  `EXPFAIL` varchar(250) DEFAULT NULL,
  `closed_with` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `samplehead_id` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `imported_rows_samplehead_id_foreign` (`samplehead_id`),
  CONSTRAINT `imported_rows_samplehead_id_foreign` FOREIGN KEY (`samplehead_id`) REFERENCES `sampleheads` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) unsigned NOT NULL,
  `reserved_at` int(10) unsigned DEFAULT NULL,
  `available_at` int(10) unsigned NOT NULL,
  `created_at` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `panelresults` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `samplehead_id` bigint(20) unsigned NOT NULL,
  `pcrpanel_id` bigint(20) unsigned NOT NULL,
  `panel_name` varchar(255) DEFAULT NULL COMMENT 'Stored panel name at time of creation for historical accuracy',
  `result_nr` varchar(255) NOT NULL,
  `fieldtype` varchar(255) NOT NULL,
  `pcrtest_id` bigint(20) unsigned DEFAULT NULL,
  `test_name` varchar(255) DEFAULT NULL,
  `well` varchar(10) DEFAULT NULL,
  `cyclecount_total` decimal(10,3) DEFAULT NULL,
  `cyclecount_alive` decimal(10,3) DEFAULT NULL,
  `cellcount_rxn_total` decimal(15,3) DEFAULT NULL,
  `cellcount_rxn_alive` decimal(15,3) DEFAULT NULL,
  `cellcount_projected_total` decimal(15,3) DEFAULT NULL,
  `cellcount_projected_alive` decimal(15,3) DEFAULT NULL,
  `ratio` decimal(10,3) DEFAULT NULL,
  `resulttext` text DEFAULT NULL,
  `pcrpanel_field_id` bigint(20) unsigned DEFAULT NULL,
  `customfield_name` varchar(255) DEFAULT NULL,
  `customfield_value` decimal(15,3) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `plant_id` bigint(20) unsigned DEFAULT NULL,
  `resulttext_content` longtext DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `panelresults_pcrpanel_id_foreign` (`pcrpanel_id`),
  KEY `panelresults_samplehead_id_pcrpanel_id_index` (`samplehead_id`,`pcrpanel_id`),
  KEY `panelresults_fieldtype_index` (`fieldtype`),
  KEY `panelresults_pcrtest_id_index` (`pcrtest_id`),
  KEY `panelresults_pcrpanel_field_id_index` (`pcrpanel_field_id`),
  KEY `panelresults_result_nr_index` (`result_nr`),
  KEY `panelresults_plant_id_index` (`plant_id`),
  CONSTRAINT `panelresults_pcrpanel_field_id_foreign` FOREIGN KEY (`pcrpanel_field_id`) REFERENCES `pcrpanel_fields` (`id`) ON DELETE CASCADE,
  CONSTRAINT `panelresults_pcrpanel_id_foreign` FOREIGN KEY (`pcrpanel_id`) REFERENCES `pcrpanels` (`id`) ON DELETE CASCADE,
  CONSTRAINT `panelresults_pcrtest_id_foreign` FOREIGN KEY (`pcrtest_id`) REFERENCES `pcrtests` (`id`) ON DELETE CASCADE,
  CONSTRAINT `panelresults_plant_id_foreign` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`) ON DELETE CASCADE,
  CONSTRAINT `panelresults_samplehead_id_foreign` FOREIGN KEY (`samplehead_id`) REFERENCES `sampleheads` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `pcrpanel_fields` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `pcrpanel_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` enum('sum','ratio') NOT NULL,
  `source_column` varchar(255) DEFAULT NULL,
  `pcrtest_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`pcrtest_ids`)),
  `referenced_field_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`referenced_field_ids`)),
  `order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pcrpanel_fields_pcrpanel_id_foreign` (`pcrpanel_id`),
  CONSTRAINT `pcrpanel_fields_pcrpanel_id_foreign` FOREIGN KEY (`pcrpanel_id`) REFERENCES `pcrpanels` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `pcrpanels` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `shortname` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `pcrpanels_pcrtests` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `pcrpanel_id` bigint(20) unsigned NOT NULL,
  `pcrtest_id` bigint(20) unsigned NOT NULL,
  `order` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `pcrtests` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `measured` varchar(255) NOT NULL,
  `measured_alive` varchar(255) NOT NULL,
  `qpcr_eff` float DEFAULT NULL,
  `qpcr_slope` float DEFAULT NULL,
  `qpcr_lot` varchar(255) DEFAULT NULL,
  `pcrtype_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `copynumber16s` decimal(8,3) NOT NULL DEFAULT 1.000,
  PRIMARY KEY (`id`),
  KEY `pcrtests_pcrtype_id_foreign` (`pcrtype_id`),
  CONSTRAINT `pcrtests_pcrtype_id_foreign` FOREIGN KEY (`pcrtype_id`) REFERENCES `pcrtypes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `pcrtypes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `permissions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `plant_user` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `plant_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `plant_user_plant_id_foreign` (`plant_id`),
  KEY `plant_user_user_id_foreign` (`user_id`),
  CONSTRAINT `plant_user_plant_id_foreign` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`) ON DELETE CASCADE,
  CONSTRAINT `plant_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `plants` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) unsigned NOT NULL,
  `name` tinytext NOT NULL,
  `address` tinytext DEFAULT NULL,
  `address2` tinytext DEFAULT NULL,
  `zip` tinytext NOT NULL,
  `country` tinytext NOT NULL,
  `town` tinytext NOT NULL,
  `phone` tinytext DEFAULT NULL,
  `email` tinytext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `plants_customer_id_foreign` (`customer_id`),
  CONSTRAINT `plants_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `poms` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `plant_id` bigint(20) unsigned NOT NULL,
  `name` tinytext NOT NULL,
  `phone` tinytext DEFAULT NULL,
  `email` tinytext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `poms_plant_id_foreign` (`plant_id`),
  CONSTRAINT `poms_plant_id_foreign` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `sampleheads` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `plant_id` bigint(20) unsigned DEFAULT NULL,
  `sample_taken_location` varchar(255) NOT NULL,
  `sample_nr` varchar(255) DEFAULT NULL,
  `analyticsresult_nr` varchar(255) DEFAULT NULL,
  `sample_taken_date` date DEFAULT NULL,
  `sample_analyzed_date` date DEFAULT NULL,
  `temperature` decimal(8,3) NOT NULL,
  `ts` decimal(8,3) NOT NULL,
  `sv` decimal(8,3) NOT NULL,
  `si` decimal(8,3) NOT NULL,
  `ph` decimal(8,3) NOT NULL,
  `nh4n` decimal(8,3) NOT NULL,
  `no2n` decimal(8,3) NOT NULL,
  `no3n` decimal(8,3) NOT NULL,
  `samples_count` int(11) DEFAULT NULL,
  `runfile` varchar(255) DEFAULT NULL,
  `sample_volume` decimal(8,3) DEFAULT NULL,
  `sample_volume_ic` decimal(8,3) DEFAULT NULL,
  `probe` decimal(8,3) DEFAULT NULL,
  `volume_extraction` bigint(20) unsigned NOT NULL,
  `sample_volume_afterextraction` decimal(15,5) DEFAULT NULL,
  `sample_rxn` decimal(15,5) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `pcrpanel_id` bigint(20) unsigned DEFAULT NULL,
  `normalised_probe` decimal(15,8) DEFAULT NULL,
  `pcr_references` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`pcr_references`)),
  `resulttext` text DEFAULT NULL,
  `ordernumber` varchar(255) DEFAULT NULL,
  `orderdate` date DEFAULT NULL,
  `runfiles` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`runfiles`)),
  `billed` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `sampleheads_plant_id_foreign` (`plant_id`),
  KEY `sampleheads_pcrpanel_id_foreign` (`pcrpanel_id`),
  CONSTRAINT `sampleheads_pcrpanel_id_foreign` FOREIGN KEY (`pcrpanel_id`) REFERENCES `pcrpanels` (`id`),
  CONSTRAINT `sampleheads_plant_id_foreign` FOREIGN KEY (`plant_id`) REFERENCES `plants` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `samplelines` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sample_id` bigint(20) unsigned DEFAULT NULL,
  `pcrtest_id` bigint(20) unsigned DEFAULT NULL,
  `qpcr` decimal(18,5) DEFAULT NULL,
  `qpcr_slope` decimal(18,5) DEFAULT NULL,
  `pcr_lot` bigint(20) DEFAULT NULL,
  `ct_total` decimal(18,5) DEFAULT NULL,
  `ct_total_alive` decimal(18,5) DEFAULT NULL,
  `ct_posk` decimal(18,5) DEFAULT NULL,
  `ct_rxn_total` decimal(18,5) DEFAULT NULL,
  `ct_rxn_total_alive` decimal(18,5) DEFAULT NULL,
  `162_copy` decimal(18,5) DEFAULT NULL,
  `ic_ct` decimal(18,5) DEFAULT NULL,
  `qpcr_count` decimal(18,5) DEFAULT NULL,
  `qpcr_count_projection` decimal(15,8) DEFAULT NULL,
  `qpcr_count_alive` decimal(18,5) DEFAULT NULL,
  `qpcr_count_alive_projection` decimal(15,8) DEFAULT NULL,
  `qpcr_count_rel` decimal(18,5) DEFAULT NULL,
  `normalised_probe` decimal(18,5) DEFAULT NULL,
  `normalised_th20` decimal(18,5) DEFAULT NULL,
  `analyticsresult_nr` varchar(255) DEFAULT NULL,
  `samplename` varchar(255) DEFAULT NULL,
  `targetname` varchar(255) DEFAULT NULL,
  `well` varchar(255) DEFAULT NULL,
  `qpcr_eff` decimal(18,8) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `samplelines_sample_id_foreign` (`sample_id`),
  KEY `samplelines_pcrtest_id_foreign` (`pcrtest_id`),
  CONSTRAINT `samplelines_pcrtest_id_foreign` FOREIGN KEY (`pcrtest_id`) REFERENCES `pcrtests` (`id`),
  CONSTRAINT `samplelines_sample_id_foreign` FOREIGN KEY (`sample_id`) REFERENCES `sampleheads` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'0001_01_01_000000_create_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2,'0001_01_01_000001_create_cache_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3,'0001_01_01_000002_create_jobs_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (4,'2024_12_18_225850_create_customers_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (5,'2024_12_19_223353_create_plants_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (6,'2024_12_19_223418_create_poms_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (7,'2024_12_19_223447_create_configitems_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8,'2024_12_21_215513_create_personal_access_tokens_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9,'2024_12_30_112912_add_role_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10,'2024_12_31_093639_add_custno_to_customers',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11,'2025_01_06_123845_create_pcrtypes_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12,'2025_01_06_130144_create_pcrtests_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13,'2025_01_07_002332_create_pcrpanels_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (14,'2025_01_07_002901_create_pcrpanels_pcrtests_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15,'2025_01_12_091615_create_bookings_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (16,'2025_02_09_222257_create_sampleheads_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (17,'2025_02_09_222303_create_samplelines_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (18,'2025_03_31_075605_add_customer_to_user',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (19,'2025_03_31_091950_create_permission_tables',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (20,'2025_03_31_092057_add_role_id_to_users_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (21,'2025_05_18_195314_create_imported_rows_table',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (22,'2025_06_02_064028_add_nullable_to_pcrtests',1);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (23,'2025_06_09_215517_add_panel_to_samplehead',2);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (24,'2025_06_10_210358_add_samplehead_to_imported_row',3);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (25,'2025_06_13_130237_add_nullable_to_sampleline',4);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (26,'2025_06_15_222201_alter_fields_for_decimal_precision',5);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (27,'2025_06_15_225559_create_contacts_table',6);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (28,'2025_06_16_074433_add_shortname_to_pcr_panel',7);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (29,'2025_06_23_221330_alter_new_fields_for_decimal_precision',8);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (30,'2025_06_24_084414_update_bookings_table',9);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (31,'2025_07_03_162439_update_users_table',10);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (32,'2025_07_03_163637_create_plant_user_pivot_table',10);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (33,'2025_07_03_165027_drop_contacts_table',11);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (34,'2025_07_05_053313_add_maincontact_to_users',12);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (35,'2025_07_06_205126_add_projection_columns_to_samplelines_table',13);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (36,'2025_07_07_074124_add_normalised_to_sampleheads',14);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (37,'2025_07_22_195546_add_pcr_references_to_sampleheads_table',15);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (38,'2025_07_31_111047_make_billed_nullable',16);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (39,'2025_08_21_023628_add_copynumber_to_pcrtest',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (40,'2025_08_21_024220_add_copynumber_default_to_pcrtest',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (41,'2025_08_23_213007_add_resulttext_to_sampleheads_table',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (42,'2025_08_25_212244_add_order_to_pcrpanels_pcrtests_table',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (43,'2025_08_25_215856_create_pcrpanel_fields_table',17);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (44,'2025_08_28_215042_add_referenced_field_ids_to_pcrpanel_fields_table',18);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (45,'2025_08_29_203838_add_can_edit_to_users_table',19);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (46,'2025_09_03_204506_add_accessible_plant_ids_to_users_table',20);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (47,'2025_09_06_205515_make_sourcecolumn_nullable_in_pcrpanel_fields',21);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (48,'2025_09_07_091246_create_panelresults_table',22);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (49,'2025_09_08_125328_add_result_nr_to_panelresults_table',23);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (50,'2025_09_09_113345_add_auftragdaten_to_samplehead_table',24);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (51,'2025_09_10_130638_add_description_to_pcrtests_table',25);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (52,'2025_09_11_102228_add_dashboard_only_to_users_table',26);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (53,'2025_09_11_111251_add_plant_id_to_panelresults_table',26);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (54,'2025_09_13_205524_add_runfiles_to_samplehead_table',27);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (55,'2025_09_18_110904_add_berechnet_to_sampleheads_table',28);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (56,'2025_09_18_150043_add_resulttext_and_panel_name_to_panelresults_table',29);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2025_09_21_085325_add_panel_name_to_panelresults',29);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2025_09_22_121640_add_resulttext_content_to_panelresults_table',30);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (59,'2025_09_22_143524_add_well_to_panelresults_table',31);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (60,'2025_09_27_095103_add_default_to_samplehead',32);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (61,'2025_10_01_054747_add_name2_to_customers_table',33);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (62,'2025_10_01_062006_add_purchase_date_to_bookings_table',34);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (63,'2025_10_01_072908_add_give_name_to_users_table',35);
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (64,'2025_10_01_172044_make_name2_nullable_on_customers',36);
