-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `nbrp_aegis`
--

-- --------------------------------------------------------

--
-- Table structure for table `discordapplication`
--

CREATE TABLE `discordapplication` (
  `id` int(11) NOT NULL,
  `typeId` int(11) NOT NULL,
  `applicantId` varchar(100) NOT NULL,
  `applicantName` varchar(100) NOT NULL,
  `data` longtext NOT NULL,
  `status` enum('PENDING','APPROVED','REJECTED') NOT NULL DEFAULT 'PENDING',
  `submittedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `reviewedAt` datetime(3) DEFAULT NULL,
  `reviewedBy` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discordapplicationtype`
--

CREATE TABLE `discordapplicationtype` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `discordBotId` int(11) NOT NULL,
  `createdBy` int(11) NOT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `visibleToRoles` text NOT NULL DEFAULT 'VERIAGENT,MODERATOR,DEVELOPERS,ADMIN,SUPER_ADMIN'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discordbot`
--

CREATE TABLE `discordbot` (
  `id` int(11) NOT NULL,
  `name` varchar(191) NOT NULL,
  `token` text NOT NULL,
  `clientId` varchar(191) NOT NULL,
  `guildId` varchar(191) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `botType` varchar(191) NOT NULL DEFAULT 'general',
  `clientSecret` text DEFAULT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'offline',
  `whitelistChannelId` varchar(191) DEFAULT NULL,
  `announcementChannelId` varchar(191) DEFAULT NULL,
  `announcementColor` varchar(191) DEFAULT '#f97316',
  `changelogChannelId` varchar(191) DEFAULT NULL,
  `changelogColor` varchar(191) DEFAULT '#22c55e',
  `changelogRoleId` varchar(191) DEFAULT NULL,
  `teamName` varchar(191) DEFAULT 'Team Nightbox',
  `ticketVisibleRoleIds` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discordbotform`
--

CREATE TABLE `discordbotform` (
  `id` int(11) NOT NULL,
  `botId` int(11) NOT NULL,
  `formId` int(11) NOT NULL,
  `channelId` varchar(191) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `sortOrder` int(11) NOT NULL DEFAULT 0,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `discordnotificationconfig`
--

CREATE TABLE `discordnotificationconfig` (
  `id` int(11) NOT NULL,
  `serverId` varchar(191) NOT NULL,
  `serverName` varchar(191) NOT NULL,
  `channelId` varchar(191) NOT NULL,
  `channelName` varchar(191) NOT NULL,
  `notificationType` varchar(191) NOT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `customMessage` text DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `document`
--

CREATE TABLE `document` (
  `id` int(11) NOT NULL,
  `title` varchar(191) NOT NULL,
  `content` longtext DEFAULT NULL,
  `excerpt` text DEFAULT NULL,
  `category` varchar(191) DEFAULT NULL,
  `tags` text DEFAULT NULL,
  `fileUrl` varchar(191) DEFAULT NULL,
  `fileName` varchar(191) DEFAULT NULL,
  `fileType` varchar(191) DEFAULT NULL,
  `fileSize` int(11) DEFAULT NULL,
  `status` enum('DRAFT','PUBLISHED','ARCHIVED') NOT NULL DEFAULT 'DRAFT',
  `visibility` enum('PUBLIC','INTERNAL','RESTRICTED') NOT NULL DEFAULT 'INTERNAL',
  `version` int(11) NOT NULL DEFAULT 1,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL,
  `publishedAt` datetime(3) DEFAULT NULL,
  `authorId` int(11) NOT NULL,
  `visibleToRoles` text NOT NULL DEFAULT 'VERIAGENT,MODERATOR,DEVELOPERS,ADMIN,SUPER_ADMIN'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document`
--

INSERT INTO `document` (`id`, `title`, `content`, `excerpt`, `category`, `tags`, `fileUrl`, `fileName`, `fileType`, `fileSize`, `status`, `visibility`, `version`, `createdAt`, `updatedAt`, `publishedAt`, `authorId`, `visibleToRoles`) VALUES
(1, 'test', '<p><ul><li><b>test</b></li></ul></p>', 'test', 'Training', 'test', NULL, NULL, NULL, NULL, 'DRAFT', 'INTERNAL', 1, '2025-08-26 09:03:41.761', '2025-08-26 09:03:41.761', NULL, 1, 'VERIAGENT,MODERATOR,DEVELOPERS,ADMIN,SUPER_ADMIN');

-- --------------------------------------------------------

--
-- Table structure for table `document_version`
--

CREATE TABLE `document_version` (
  `id` int(11) NOT NULL,
  `documentId` int(11) NOT NULL,
  `version` int(11) NOT NULL,
  `title` varchar(191) NOT NULL,
  `content` longtext DEFAULT NULL,
  `changes` text DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `createdBy` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `document_version`
--

INSERT INTO `document_version` (`id`, `documentId`, `version`, `title`, `content`, `changes`, `createdAt`, `createdBy`) VALUES
(1, 1, 1, 'test', '<p><ul><li><b>test</b></li></ul></p>', 'Initial creation', '2025-08-26 09:03:41.768', 1);

-- --------------------------------------------------------

--
-- Table structure for table `formsubmission`
--

CREATE TABLE `formsubmission` (
  `id` int(11) NOT NULL,
  `formId` int(11) NOT NULL,
  `submittedBy` varchar(191) NOT NULL,
  `formData` longtext NOT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'Pending',
  `reviewedBy` int(11) DEFAULT NULL,
  `reviewedAt` datetime(3) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `discordMessageId` varchar(64) DEFAULT NULL,
  `discordThreadId` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `report`
--

CREATE TABLE `report` (
  `id` int(11) NOT NULL,
  `reporterName` varchar(191) NOT NULL,
  `playerName` varchar(191) NOT NULL,
  `discordUserId` varchar(191) NOT NULL,
  `subject` varchar(191) NOT NULL,
  `description` text NOT NULL,
  `priority` varchar(191) NOT NULL DEFAULT 'Medium',
  `status` varchar(191) NOT NULL DEFAULT 'Open',
  `attachments` longtext DEFAULT NULL,
  `linkedReports` text DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `violations` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `setting`
--

CREATE TABLE `setting` (
  `id` int(11) NOT NULL,
  `key` varchar(191) NOT NULL,
  `value` longtext DEFAULT NULL,
  `encrypted` tinyint(1) NOT NULL DEFAULT 0,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `streamer`
--

CREATE TABLE `streamer` (
  `id` int(11) NOT NULL,
  `username` varchar(191) NOT NULL,
  `platform` enum('TWITCH','YOUTUBE','TIKTOK','KICK') NOT NULL,
  `platformUserId` varchar(191) DEFAULT NULL,
  `displayName` varchar(191) DEFAULT NULL,
  `profileImageUrl` varchar(191) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `lastChecked` datetime(3) DEFAULT NULL,
  `lastLiveAt` datetime(3) DEFAULT NULL,
  `isCurrentlyLive` tinyint(1) NOT NULL DEFAULT 0,
  `currentTitle` varchar(191) DEFAULT NULL,
  `currentGame` varchar(191) DEFAULT NULL,
  `currentViewers` int(11) DEFAULT NULL,
  `discordBotId` int(11) DEFAULT NULL,
  `discordChannelId` varchar(191) DEFAULT NULL,
  `customMessage` varchar(191) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `createdBy` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `streamnotification`
--

CREATE TABLE `streamnotification` (
  `id` int(11) NOT NULL,
  `streamerId` int(11) NOT NULL,
  `platform` enum('TWITCH','YOUTUBE','TIKTOK','KICK') NOT NULL,
  `title` varchar(191) DEFAULT NULL,
  `game` varchar(191) DEFAULT NULL,
  `viewers` int(11) DEFAULT NULL,
  `startedAt` datetime(3) NOT NULL,
  `endedAt` datetime(3) DEFAULT NULL,
  `notificationSent` tinyint(1) NOT NULL DEFAULT 0,
  `discordMessageId` varchar(191) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `todo`
--

CREATE TABLE `todo` (
  `id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('PENDING','IN_PROGRESS','COMPLETED') NOT NULL DEFAULT 'PENDING',
  `priority` enum('LOW','MEDIUM','HIGH','URGENT') NOT NULL DEFAULT 'MEDIUM',
  `assignedTo` int(11) DEFAULT NULL,
  `dueDate` datetime(3) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL,
  `completedAt` datetime(3) DEFAULT NULL,
  `createdBy` int(11) DEFAULT NULL,
  `categoryId` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `todo_category`
--

CREATE TABLE `todo_category` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `color` varchar(7) DEFAULT '#3B82F6',
  `isActive` tinyint(1) DEFAULT 1,
  `parentId` int(11) DEFAULT NULL,
  `sortOrder` int(11) DEFAULT 0,
  `visibleToRoles` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`visibleToRoles`)),
  `createdAt` datetime DEFAULT current_timestamp(),
  `updatedAt` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `createdBy` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `todo_category`
--

INSERT INTO `todo_category` (`id`, `name`, `description`, `color`, `isActive`, `parentId`, `sortOrder`, `visibleToRoles`, `createdAt`, `updatedAt`, `createdBy`) VALUES
(1, 'Veriagent', 'Oppgaver for Veriagenter', '#10B981', 1, NULL, 1, '[\"VERIAGENT\", \"MODERATOR\", \"DEVELOPERS\", \"ADMIN\", \"SUPER_ADMIN\"]', '2025-08-26 14:06:44', '2025-08-26 14:06:44', 1),
(2, 'Moderator', 'Oppgaver for Moderatorer', '#8B5CF6', 1, NULL, 2, '[\"MODERATOR\", \"DEVELOPERS\", \"ADMIN\", \"SUPER_ADMIN\"]', '2025-08-26 14:06:44', '2025-08-26 14:06:44', 1),
(3, 'Utvikler', 'Oppgaver for Utviklere', '#06B6D4', 1, NULL, 3, '[\"DEVELOPERS\", \"ADMIN\", \"SUPER_ADMIN\"]', '2025-08-26 14:06:44', '2025-08-26 14:06:44', 1),
(4, 'Admin', 'Administrative oppgaver', '#F59E0B', 1, NULL, 4, '[\"ADMIN\", \"SUPER_ADMIN\"]', '2025-08-26 14:06:44', '2025-08-26 14:06:44', 1),
(5, 'Lederskapet', 'Lederoppgaver', '#EF4444', 1, NULL, 5, '[\"SUPER_ADMIN\"]', '2025-08-26 14:06:44', '2025-08-26 14:06:44', 1);

-- --------------------------------------------------------

--
-- Table structure for table `txadmin_server_config`
--

CREATE TABLE `txadmin_server_config` (
  `id` int(11) NOT NULL,
  `serverUrl` varchar(255) NOT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `txadmin_server_config`
--

INSERT INTO `txadmin_server_config` (`id`, `serverUrl`, `isActive`, `createdAt`, `updatedAt`) VALUES
(1, 'http://localhost:40120/', 1, '2025-08-25 21:10:40.656', '2025-08-25 21:10:40.656');

-- --------------------------------------------------------

--
-- Table structure for table `txadmin_user_config`
--

CREATE TABLE `txadmin_user_config` (
  `id` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `isLoggedIn` tinyint(1) NOT NULL DEFAULT 0,
  `lastLogin` datetime(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `txadmin_user_config`
--

INSERT INTO `txadmin_user_config` (`id`, `userId`, `username`, `password`, `createdAt`, `updatedAt`, `isActive`, `isLoggedIn`, `lastLogin`) VALUES
(1, 1, 'melissa_tambs', 'f4cabb92a392c01d85391d682d93ed19:5326efedc9a1129d04affbd0a8956946', '2025-08-25 21:10:07.351', '2025-08-25 21:10:07.351', 1, 0, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(191) NOT NULL,
  `email` varchar(191) NOT NULL,
  `password` varchar(191) NOT NULL,
  `firstName` varchar(191) DEFAULT NULL,
  `lastName` varchar(191) DEFAULT NULL,
  `role` enum('VERIAGENT','MODERATOR','DEVELOPERS','ADMIN','SUPER_ADMIN') NOT NULL DEFAULT 'VERIAGENT',
  `twoFactorEnabled` tinyint(1) NOT NULL DEFAULT 0,
  `twoFactorSecret` varchar(191) DEFAULT NULL,
  `twoFactorBackupCodes` varchar(191) DEFAULT NULL,
  `lastLogin` datetime(3) DEFAULT NULL,
  `loginAttempts` int(11) NOT NULL DEFAULT 0,
  `lockedUntil` datetime(3) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `isVerified` tinyint(1) NOT NULL DEFAULT 0,
  `isTemporaryPassword` tinyint(1) NOT NULL DEFAULT 0,
  `passwordChangeRequired` tinyint(1) NOT NULL DEFAULT 0,
  `preferredTwoFactorMethod` enum('TOTP','BOTH') NOT NULL DEFAULT 'TOTP',
  `deletedAt` datetime(3) DEFAULT NULL,
  `deletedBy` int(11) DEFAULT NULL,
  `deletedReason` varchar(191) DEFAULT NULL,
  `isDeleted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `username`, `email`, `password`, `firstName`, `lastName`, `role`, `twoFactorEnabled`, `twoFactorSecret`, `twoFactorBackupCodes`, `lastLogin`, `loginAttempts`, `lockedUntil`, `createdAt`, `updatedAt`, `isVerified`, `isTemporaryPassword`, `passwordChangeRequired`, `preferredTwoFactorMethod`, `deletedAt`, `deletedBy`, `deletedReason`, `isDeleted`) VALUES
(1, 'melissa.tambs@gmail.com', 'melissa.tambs@gmail.com', '$2b$12$JF8ml2IsTnGAlvyuAd09fuOc2hW33uT3aSdZyGjSE2qiUzk9nv8g6', 'Melissa Helena', 'Tambs', 'SUPER_ADMIN', 1, 'MJLWMVRFLJ3SS3K2JQYFEV3BOZNVISC2IBEUSNCKJIUTWMBSIRWQ', '[\"$2b$12$5UMeov44Qv/UNjbN42/TNOuYX1ijRSIittD8TB5YvVygdSw2TUFm.\",\"$2b$12$o7yhBK6oSe9RwMEgXcQRdOncmR4lChJSTxpa8VEyxO90dIu5uKSG.\",\"$2b$12$91pnn0GhorgooD26H/qodOnZTx4oIhtcpuEt3uAgQT2KMOsYEE6Im\",\"', '2025-08-26 08:17:35.479', 0, NULL, '2025-08-25 15:25:34.848', '2025-08-25 15:25:34.848', 1, 0, 0, 'TOTP', NULL, NULL, NULL, 0);

-- --------------------------------------------------------

--
-- Table structure for table `usersession`
--

CREATE TABLE `usersession` (
  `id` varchar(191) NOT NULL,
  `userId` int(11) NOT NULL,
  `token` varchar(191) NOT NULL,
  `expiresAt` datetime(3) NOT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `usersession`
--

INSERT INTO `usersession` (`id`, `userId`, `token`, `expiresAt`, `createdAt`) VALUES
('cmes9wnar0003wtz8xz639az5', 1, 'd9b8b2837092b72b76d2d8c776a74e1f4554ad9a9fd9e6555c2960e5f9742374mes9wnaq', '2025-09-16 08:17:35.474', '2025-08-26 08:17:35.476');

-- --------------------------------------------------------

--
-- Table structure for table `violation`
--

CREATE TABLE `violation` (
  `id` int(11) NOT NULL,
  `name` varchar(191) NOT NULL,
  `displayName` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `severity` enum('LOW','MEDIUM','HIGH','CRITICAL') NOT NULL DEFAULT 'MEDIUM',
  `isDefault` tinyint(1) NOT NULL DEFAULT 0,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `createdBy` int(11) DEFAULT NULL,
  `createdByName` varchar(191) DEFAULT NULL,
  `createdByRole` varchar(191) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3) ON UPDATE current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `violation`
--

INSERT INTO `violation` (`id`, `name`, `displayName`, `description`, `severity`, `isDefault`, `isActive`, `createdBy`, `createdByName`, `createdByRole`, `createdAt`, `updatedAt`) VALUES
(3, 'rdm', 'Random Death Match (RDM)', 'Killing another player without proper roleplay reason', 'HIGH', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.901', '2025-08-25 16:05:16.901'),
(4, 'vdm', 'Vehicle Death Match (VDM)', 'Using a vehicle as a weapon without roleplay reason', 'HIGH', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.910', '2025-08-25 16:05:16.910'),
(5, 'failrp', 'Fail RP', 'Breaking character or failing to maintain roleplay', 'MEDIUM', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.927', '2025-08-25 16:05:16.927'),
(6, 'metagaming', 'Metagaming', 'Using out-of-character information in roleplay', 'HIGH', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.933', '2025-08-25 16:05:16.933'),
(7, 'powergaming', 'Powergaming', 'Forcing unrealistic roleplay scenarios', 'MEDIUM', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.939', '2025-08-25 16:05:16.939'),
(8, 'nlr', 'New Life Rule (NLR)', 'Returning to area of death too quickly', 'MEDIUM', 1, 1, NULL, NULL, NULL, '2025-08-25 16:05:16.946', '2025-08-25 16:05:16.946');

-- --------------------------------------------------------

--
-- Table structure for table `webauthn_credential`
--

CREATE TABLE `webauthn_credential` (
  `id` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `credentialId` varchar(191) NOT NULL,
  `publicKey` longtext NOT NULL,
  `counter` int(11) NOT NULL DEFAULT 0,
  `transports` varchar(191) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `lastUsed` datetime(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `whitelistform`
--

CREATE TABLE `whitelistform` (
  `id` int(11) NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `welcomeMessage` text DEFAULT NULL,
  `submitButtonText` varchar(191) NOT NULL DEFAULT 'Submit Application',
  `successMessage` text DEFAULT NULL,
  `fields` longtext NOT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'Active',
  `submissions` int(11) NOT NULL DEFAULT 0,
  `createdBy` int(11) DEFAULT NULL,
  `createdAt` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `updatedAt` datetime(3) NOT NULL DEFAULT current_timestamp(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `_prisma_migrations`
--

CREATE TABLE `_prisma_migrations` (
  `id` varchar(36) NOT NULL,
  `checksum` varchar(64) NOT NULL,
  `finished_at` datetime(3) DEFAULT NULL,
  `migration_name` varchar(255) NOT NULL,
  `logs` text DEFAULT NULL,
  `rolled_back_at` datetime(3) DEFAULT NULL,
  `started_at` datetime(3) NOT NULL DEFAULT current_timestamp(3),
  `applied_steps_count` int(10) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `_prisma_migrations`
--

INSERT INTO `_prisma_migrations` (`id`, `checksum`, `finished_at`, `migration_name`, `logs`, `rolled_back_at`, `started_at`, `applied_steps_count`) VALUES
('09206e89-74b8-4dba-bd14-497ad35fed90', '0d72359a4a43d031fa66d064a46c2c1f60c816be4ac50dd9d55a1989979db84f', '2025-08-25 12:46:46.505', '20250728115617_add_streamwatch_tables', NULL, NULL, '2025-08-25 12:46:46.302', 1),
('1065b544-d4b7-43c1-b819-cb2c91624eb0', '3367fd9fd811fa3e1044ea4b0cf1d50392a7c371d89c48547022a465a613603b', '2025-08-25 12:46:46.265', '20250728085501_discord_bot_forms_many_to_many', NULL, NULL, '2025-08-25 12:46:46.124', 1),
('34d5cb26-2427-456f-aa0c-b323dd15e074', 'b4d3dacf5160736d1abc480942233edde4555edb61cd60d394275afbdce1b75a', '2025-08-25 12:46:46.095', '20250728083915_add_discord_bots_table', NULL, NULL, '2025-08-25 12:46:45.955', 1),
('4170ab89-4757-469d-ab5f-2169515d9003', '5da7b4a96c13fd6f91b3aa120b6740b82018fc8615c84fbe3fb15226c80512a7', '2025-08-25 13:10:16.491', '20250825131016_add_violations_system', NULL, NULL, '2025-08-25 13:10:16.297', 1),
('46d43c23-fa9c-4f01-b4ee-b8366bebd609', '4fed65500bbee5dac3cd2b80077d395cf8a44753b60c81483ca6b34077dbe613', '2025-08-25 12:46:45.294', '20250723091736_add_password_management_fields', NULL, NULL, '2025-08-25 12:46:44.747', 1),
('4dee8ec7-eca1-4df5-8617-be2e536873c9', 'cd838a300349902305c2506f3596ba3d737a2e5bfecd21dfd68dcb7da298d826', '2025-08-25 12:46:46.122', '20250728084600_add_bot_type_field', NULL, NULL, '2025-08-25 12:46:46.097', 1),
('50b9c609-c5b6-4879-9be9-546bfbc2d04e', '7b9de191c34b1bbf979ece6bdc90bd4b6d6b53d5f5b7c3d517c58115b4718e97', '2025-08-25 12:47:50.385', '20250825124749_add_user_preservation_and_soft_delete', NULL, NULL, '2025-08-25 12:47:49.562', 1),
('8e770a6a-3fa7-4f71-969b-b5ed78831c48', '4329b3d64d4f8a6fe7bf65a64a075b21ccb52827efe880420f81383ec778ca06', '2025-08-25 12:46:45.304', '20250723142453_add_user_permissions', NULL, NULL, '2025-08-25 12:46:45.295', 1),
('970bf2c0-d32d-4c08-8a5c-3ab8e4e461d4', 'f92472a2f95927b852fa3f67a8d4cf69d71cd225bf54c3f318e9582d8bc76383', '2025-08-25 12:46:45.746', '20250728080512_remove_ecommerce_tables', NULL, NULL, '2025-08-25 12:46:45.658', 1),
('98aeebe7-2d48-4f71-b6a2-0718154ef83b', '27e98865649a494749e7007e206b4dc4df08bf9e2d48ecd1ee836181ba216c00', '2025-08-25 12:46:47.143', '20250730105701_remove_cfxid_add_missing_fields', NULL, NULL, '2025-08-25 12:46:46.507', 1),
('ab394193-34fd-4fda-9d2e-3c7d5858559e', '93b4596230c2d20ab9da4be2c13c5beea3b455f19732cd81dfde864b25d1baf6', '2025-08-25 12:46:47.198', '20250810_remove_push_add_webauthn', NULL, NULL, '2025-08-25 12:46:47.144', 1),
('abefec38-08ca-4bb9-b5df-dc41b44727fe', '76eb11242bfe1faf18c219f53b5e7ca2fade06c1d040ef57da076b0340fb1cbf', '2025-08-25 12:46:45.954', '20250728082408_add_forms_tables', NULL, NULL, '2025-08-25 12:46:45.748', 1),
('afbf0b2c-7a33-4130-a028-8d1386e84b79', '341ddff9a277059c881cb96b29a7193bff48596be805c492b4f68cced4c14f89', '2025-08-25 12:46:46.301', '20250728093650_add_settings_table', NULL, NULL, '2025-08-25 12:46:46.266', 1),
('e87fb28c-478a-4d68-8593-68d25e2de6a0', '3c37da2c6cc973d8e3bdc28d06ea3045d9ad12de95de2646de802f63363e855c', '2025-08-25 12:46:45.315', '20250723142746_set_default_permissions', NULL, NULL, '2025-08-25 12:46:45.306', 1),
('e977c1fa-68bd-4811-964c-1cf50ff4463d', 'c2b4d53e08a9526ee383d4a0adb10d27b9c147fbb94b3e3c97ea74a35abf2ac5', '2025-08-25 12:46:45.656', '20250728075701_add_reports_table', NULL, NULL, '2025-08-25 12:46:45.316', 1);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `discordapplication`
--
ALTER TABLE `discordapplication`
  ADD PRIMARY KEY (`id`),
  ADD KEY `discordapplication_typeId_idx` (`typeId`),
  ADD KEY `discordapplication_status_idx` (`status`),
  ADD KEY `discordapplication_applicantId_idx` (`applicantId`),
  ADD KEY `discordapplication_submittedAt_idx` (`submittedAt`),
  ADD KEY `discordapplication_reviewedBy_idx` (`reviewedBy`);

--
-- Indexes for table `discordapplicationtype`
--
ALTER TABLE `discordapplicationtype`
  ADD PRIMARY KEY (`id`),
  ADD KEY `discordapplicationtype_discordBotId_idx` (`discordBotId`),
  ADD KEY `discordapplicationtype_createdBy_idx` (`createdBy`);

--
-- Indexes for table `discordbot`
--
ALTER TABLE `discordbot`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_bot_active` (`isActive`),
  ADD KEY `idx_bot_type` (`botType`);

--
-- Indexes for table `discordbotform`
--
ALTER TABLE `discordbotform`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_bot_form` (`botId`,`formId`),
  ADD KEY `idx_bot_form_bot` (`botId`),
  ADD KEY `idx_bot_form_form` (`formId`);

--
-- Indexes for table `discordnotificationconfig`
--
ALTER TABLE `discordnotificationconfig`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_server_channel_type` (`serverId`,`channelId`,`notificationType`),
  ADD KEY `idx_discord_config_server` (`serverId`),
  ADD KEY `idx_discord_config_type` (`notificationType`),
  ADD KEY `idx_discord_config_active` (`isActive`);

--
-- Indexes for table `document`
--
ALTER TABLE `document`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_document_author` (`authorId`),
  ADD KEY `idx_document_category` (`category`),
  ADD KEY `idx_document_status` (`status`),
  ADD KEY `idx_document_visibility` (`visibility`),
  ADD KEY `idx_document_created` (`createdAt`);

--
-- Indexes for table `document_version`
--
ALTER TABLE `document_version`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `document_version_documentId_version_key` (`documentId`,`version`),
  ADD KEY `idx_document_version_doc` (`documentId`),
  ADD KEY `idx_document_version_user` (`createdBy`);

--
-- Indexes for table `formsubmission`
--
ALTER TABLE `formsubmission`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_submission_form` (`formId`),
  ADD KEY `idx_submission_created` (`createdAt`),
  ADD KEY `idx_submission_status` (`status`),
  ADD KEY `formSubmission_reviewedBy_fkey` (`reviewedBy`);

--
-- Indexes for table `report`
--
ALTER TABLE `report`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_report_created` (`createdAt`),
  ADD KEY `idx_report_status` (`status`),
  ADD KEY `idx_report_priority` (`priority`),
  ADD KEY `idx_report_player` (`playerName`),
  ADD KEY `report_createdBy_fkey` (`createdBy`);

--
-- Indexes for table `setting`
--
ALTER TABLE `setting`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `setting_key_key` (`key`),
  ADD KEY `idx_setting_key` (`key`);

--
-- Indexes for table `streamer`
--
ALTER TABLE `streamer`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_streamer_platform` (`username`,`platform`),
  ADD KEY `idx_streamer_platform` (`platform`),
  ADD KEY `idx_streamer_active` (`isActive`),
  ADD KEY `idx_streamer_live` (`isCurrentlyLive`),
  ADD KEY `idx_streamer_creator` (`createdBy`),
  ADD KEY `streamer_discordBotId_fkey` (`discordBotId`);

--
-- Indexes for table `streamnotification`
--
ALTER TABLE `streamnotification`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_notification_streamer` (`streamerId`),
  ADD KEY `idx_notification_started` (`startedAt`),
  ADD KEY `idx_notification_sent` (`notificationSent`);

--
-- Indexes for table `todo`
--
ALTER TABLE `todo`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_todo_status` (`status`),
  ADD KEY `idx_todo_priority` (`priority`),
  ADD KEY `idx_todo_assigned_to` (`assignedTo`),
  ADD KEY `idx_todo_due_date` (`dueDate`),
  ADD KEY `idx_todo_created_by` (`createdBy`),
  ADD KEY `idx_todo_created_at` (`createdAt`),
  ADD KEY `idx_todo_category` (`categoryId`);

--
-- Indexes for table `todo_category`
--
ALTER TABLE `todo_category`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_category_parent` (`parentId`),
  ADD KEY `idx_category_active` (`isActive`),
  ADD KEY `idx_category_sort` (`sortOrder`),
  ADD KEY `fk_category_created_by` (`createdBy`);

--
-- Indexes for table `txadmin_server_config`
--
ALTER TABLE `txadmin_server_config`
  ADD PRIMARY KEY (`id`),
  ADD KEY `txadmin_server_config_isActive_idx` (`isActive`);

--
-- Indexes for table `txadmin_user_config`
--
ALTER TABLE `txadmin_user_config`
  ADD PRIMARY KEY (`id`),
  ADD KEY `txadmin_user_config_isActive_idx` (`isActive`),
  ADD KEY `txadmin_user_config_userId_idx` (`userId`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `User_username_key` (`username`),
  ADD UNIQUE KEY `User_email_key` (`email`),
  ADD KEY `idx_user_email` (`email`),
  ADD KEY `idx_user_role` (`role`),
  ADD KEY `idx_user_username` (`username`),
  ADD KEY `idx_user_deleted` (`isDeleted`),
  ADD KEY `user_deletedBy_fkey` (`deletedBy`);

--
-- Indexes for table `usersession`
--
ALTER TABLE `usersession`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UserSession_token_key` (`token`),
  ADD KEY `UserSession_userId_fkey` (`userId`);

--
-- Indexes for table `violation`
--
ALTER TABLE `violation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `Violation_createdBy_fkey` (`createdBy`);

--
-- Indexes for table `webauthn_credential`
--
ALTER TABLE `webauthn_credential`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `webauthn_credential_credentialId_key` (`credentialId`),
  ADD KEY `webauthn_credential_userId_idx` (`userId`);

--
-- Indexes for table `whitelistform`
--
ALTER TABLE `whitelistform`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_form_created` (`createdAt`),
  ADD KEY `idx_form_status` (`status`),
  ADD KEY `whitelistForm_createdBy_fkey` (`createdBy`);

--
-- Indexes for table `_prisma_migrations`
--
ALTER TABLE `_prisma_migrations`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `discordapplication`
--
ALTER TABLE `discordapplication`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discordapplicationtype`
--
ALTER TABLE `discordapplicationtype`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discordbot`
--
ALTER TABLE `discordbot`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discordbotform`
--
ALTER TABLE `discordbotform`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discordnotificationconfig`
--
ALTER TABLE `discordnotificationconfig`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `document`
--
ALTER TABLE `document`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `document_version`
--
ALTER TABLE `document_version`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `formsubmission`
--
ALTER TABLE `formsubmission`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `report`
--
ALTER TABLE `report`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `setting`
--
ALTER TABLE `setting`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `streamer`
--
ALTER TABLE `streamer`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `streamnotification`
--
ALTER TABLE `streamnotification`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `todo`
--
ALTER TABLE `todo`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `todo_category`
--
ALTER TABLE `todo_category`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `txadmin_server_config`
--
ALTER TABLE `txadmin_server_config`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `txadmin_user_config`
--
ALTER TABLE `txadmin_user_config`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `violation`
--
ALTER TABLE `violation`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `webauthn_credential`
--
ALTER TABLE `webauthn_credential`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `whitelistform`
--
ALTER TABLE `whitelistform`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `discordapplication`
--
ALTER TABLE `discordapplication`
  ADD CONSTRAINT `discordapplication_reviewedBy_fkey` FOREIGN KEY (`reviewedBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `discordapplication_typeId_fkey` FOREIGN KEY (`typeId`) REFERENCES `discordapplicationtype` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `discordapplicationtype`
--
ALTER TABLE `discordapplicationtype`
  ADD CONSTRAINT `discordapplicationtype_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `discordapplicationtype_discordBotId_fkey` FOREIGN KEY (`discordBotId`) REFERENCES `discordbot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `discordbotform`
--
ALTER TABLE `discordbotform`
  ADD CONSTRAINT `discordBotForm_botId_fkey` FOREIGN KEY (`botId`) REFERENCES `discordbot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `discordBotForm_formId_fkey` FOREIGN KEY (`formId`) REFERENCES `whitelistform` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `document`
--
ALTER TABLE `document`
  ADD CONSTRAINT `document_authorId_fkey` FOREIGN KEY (`authorId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `document_version`
--
ALTER TABLE `document_version`
  ADD CONSTRAINT `document_version_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `document_version_documentId_fkey` FOREIGN KEY (`documentId`) REFERENCES `document` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `formsubmission`
--
ALTER TABLE `formsubmission`
  ADD CONSTRAINT `formSubmission_formId_fkey` FOREIGN KEY (`formId`) REFERENCES `whitelistform` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `formSubmission_reviewedBy_fkey` FOREIGN KEY (`reviewedBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `report`
--
ALTER TABLE `report`
  ADD CONSTRAINT `report_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `streamer`
--
ALTER TABLE `streamer`
  ADD CONSTRAINT `streamer_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `streamer_discordBotId_fkey` FOREIGN KEY (`discordBotId`) REFERENCES `discordbot` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `streamnotification`
--
ALTER TABLE `streamnotification`
  ADD CONSTRAINT `streamNotification_streamerId_fkey` FOREIGN KEY (`streamerId`) REFERENCES `streamer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `todo`
--
ALTER TABLE `todo`
  ADD CONSTRAINT `fk_todo_category` FOREIGN KEY (`categoryId`) REFERENCES `todo_category` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `todo_assignedTo_fkey` FOREIGN KEY (`assignedTo`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `todo_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `todo_category`
--
ALTER TABLE `todo_category`
  ADD CONSTRAINT `fk_category_created_by` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_category_parent` FOREIGN KEY (`parentId`) REFERENCES `todo_category` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `user`
--
ALTER TABLE `user`
  ADD CONSTRAINT `user_deletedBy_fkey` FOREIGN KEY (`deletedBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `usersession`
--
ALTER TABLE `usersession`
  ADD CONSTRAINT `UserSession_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `violation`
--
ALTER TABLE `violation`
  ADD CONSTRAINT `Violation_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `webauthn_credential`
--
ALTER TABLE `webauthn_credential`
  ADD CONSTRAINT `webauthn_credential_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `whitelistform`
--
ALTER TABLE `whitelistform`
  ADD CONSTRAINT `whitelistForm_createdBy_fkey` FOREIGN KEY (`createdBy`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;

