Advertisement
RapidMod

Recruiter SQL Tables

Mar 27th, 2023 (edited)
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 6.48 KB | None | 0 0
  1. /**
  2.  * Database Schema for [Your Application's Name]
  3.  *
  4.  * This script defines the schema for a series of tables critical to the application's functionality. It includes:
  5.  * - `api_key`: Manages API keys with associated usage credits and types.
  6.  * - `candidates`: Tracks candidates sourced for recruitment, including various metadata and status indicators.
  7.  * - `client`: Stores client information, vital for managing client interactions and data.
  8.  * - `requests`: Details requests made by or for clients, encompassing job details and assignment tracking.
  9.  * - `user`: Manages user accounts, roles, and authentication within the application.
  10.  *
  11.  * Each table is designed with a focus on extensibility, security, and robust data management, ensuring that the application
  12.  * can scale and adapt to future requirements.
  13.  *
  14.  * Author: RapidMod
  15.  * Website: https://rapidmod.io/
  16.  *
  17.  * Note: Before executing this script, ensure that your MySQL/MariaDB server is running and accessible. Modify the script as necessary
  18.  * to align with your specific application logic and database naming conventions.
  19.  */
  20.  
  21.  
  22. | api_key | CREATE TABLE `api_key` (
  23.   `id` bigint NOT NULL AUTO_INCREMENT,
  24.   `guid` varchar(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  25.   `active` tinyint DEFAULT NULL,
  26.   `credits` int DEFAULT NULL,
  27.   `type` varchar(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'api_key',
  28.   `public_key` varchar(248) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  29.   `private_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  30.   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  31.   `updated` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  32.   `valid_until` datetime DEFAULT NULL,
  33.   `extra_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  34.   PRIMARY KEY (`id`),
  35.   UNIQUE KEY `guid` (`guid`),
  36.   KEY `type` (`type`)
  37. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
  38.  
  39.  
  40. | candidates | CREATE TABLE `candidates` (
  41.   `id` bigint NOT NULL AUTO_INCREMENT,
  42.   `guid` varchar(96) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  43.   `sourced_by` bigint DEFAULT NULL,
  44.   `recruiter_id` bigint DEFAULT NULL,
  45.   `request_id` bigint DEFAULT NULL,
  46.   `has_dripify` tinyint DEFAULT NULL,
  47.   `has_rf` tinyint DEFAULT NULL,
  48.   `date_loaded` datetime DEFAULT NULL,
  49.   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  50.   `updated` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  51.   `linkedin_profile_link_status` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  52.   `linkedin_profile_link` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  53.   `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  54.   `recruiter_notes` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  55.   `sourcer_notes` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  56.   PRIMARY KEY (`id`),
  57.   UNIQUE KEY `guid` (`guid`),
  58.   KEY `sourced_by` (`sourced_by`),
  59.   KEY `recruiter_id` (`recruiter_id`),
  60.   KEY `request_id` (`request_id`),
  61.   CONSTRAINT `candidates_ibfk_1` FOREIGN KEY (`recruiter_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  62.   CONSTRAINT `candidates_ibfk_2` FOREIGN KEY (`sourced_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  63.   CONSTRAINT `candidates_ibfk_3` FOREIGN KEY (`request_id`) REFERENCES `requests` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
  64. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
  65.  
  66. | client | CREATE TABLE `client` (
  67.   `id` bigint NOT NULL AUTO_INCREMENT,
  68.   `guid` varchar(96) COLLATE utf8mb4_unicode_ci NOT NULL,
  69.   `name` varchar(96) COLLATE utf8mb4_unicode_ci NOT NULL,
  70.   `phone` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  71.   `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  72.   `updated` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  73.   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  74.   PRIMARY KEY (`id`),
  75.   UNIQUE KEY `guid` (`guid`)
  76. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
  77.  
  78. | requests | CREATE TABLE `requests` (
  79.   `id` bigint NOT NULL AUTO_INCREMENT,
  80.   `guid` varchar(96) COLLATE utf8mb4_unicode_ci NOT NULL,
  81.   `job_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  82.   `job_city` varchar(96) COLLATE utf8mb4_unicode_ci NOT NULL,
  83.   `search_area` varchar(96) COLLATE utf8mb4_unicode_ci NOT NULL,
  84.   `search_priority` int NOT NULL,
  85.   `client_id` bigint DEFAULT NULL,
  86.   `submitted_by` bigint DEFAULT NULL,
  87.   `assigned_to` bigint DEFAULT NULL,
  88.   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  89.   `updated` datetime NOT NULL,
  90.   PRIMARY KEY (`id`),
  91.   UNIQUE KEY `guid` (`guid`),
  92.   KEY `assigned_to` (`assigned_to`),
  93.   KEY `submitted_by` (`submitted_by`),
  94.   KEY `client_id` (`client_id`),
  95.   CONSTRAINT `requests_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  96.   CONSTRAINT `requests_ibfk_2` FOREIGN KEY (`submitted_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  97.   CONSTRAINT `requests_ibfk_3` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
  98. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
  99.  
  100. | user  | CREATE TABLE `user` (
  101.   `id` bigint NOT NULL AUTO_INCREMENT,
  102.   `api_key_id` bigint DEFAULT NULL,
  103.   `contact_id` bigint DEFAULT NULL,
  104.   `role` varchar(48) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'client',
  105.   `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'this should be email address',
  106.   `email_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  107.   `guid` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  108.   `auth_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  109.   `password` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  110.   `domain` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local',
  111.   `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  112.   `last_login` datetime DEFAULT NULL,
  113.   `updated` datetime DEFAULT NULL,
  114.   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  115.   PRIMARY KEY (`id`),
  116.   KEY `contact_id` (`contact_id`),
  117.   KEY `guid` (`guid`),
  118.   KEY `api_key_id` (`api_key_id`)
  119. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT |
  120.  
  121.  
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement