CREATE TABLE `shift_templates` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `shift` bigint(20) unsigned NOT NULL,
  `day` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `shift_templates_day_unique` (`day`),
  KEY `shift_templates_shift_foreign` (`shift`),
  CONSTRAINT `shift_templates_shift_foreign` FOREIGN KEY (`shift`) REFERENCES `shift_details` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

CREATE TABLE `rosters` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `day` varchar(255) NOT NULL,
  `shift` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `rosters_date_unique` (`date`),
  KEY `rosters_shift_foreign` (`shift`),
  CONSTRAINT `rosters_shift_foreign` FOREIGN KEY (`shift`) REFERENCES `shift_details` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

CREATE TABLE `user_rosters` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `roster_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_rosters_user_id_foreign` (`user_id`),
  KEY `user_rosters_roster_id_foreign` (`roster_id`),
  CONSTRAINT `user_rosters_roster_id_foreign` FOREIGN KEY (`roster_id`) REFERENCES `rosters` (`id`),
  CONSTRAINT `user_rosters_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=961 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
