-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 29, 2026 at 12:43 AM
-- Server version: 10.11.5-MariaDB
-- PHP Version: 7.4.33

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `statsmain_main`
--

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

--
-- Table structure for table `auth_group`
--

CREATE TABLE `auth_group` (
  `id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `auth_group_permissions`
--

CREATE TABLE `auth_group_permissions` (
  `id` bigint(20) NOT NULL,
  `group_id` int(11) NOT NULL,
  `permission_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `auth_permission`
--

CREATE TABLE `auth_permission` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `content_type_id` int(11) NOT NULL,
  `codename` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `auth_permission`
--

INSERT INTO `auth_permission` (`id`, `name`, `content_type_id`, `codename`) VALUES
(1, 'Can add log entry', 1, 'add_logentry'),
(2, 'Can change log entry', 1, 'change_logentry'),
(3, 'Can delete log entry', 1, 'delete_logentry'),
(4, 'Can view log entry', 1, 'view_logentry'),
(5, 'Can add permission', 2, 'add_permission'),
(6, 'Can change permission', 2, 'change_permission'),
(7, 'Can delete permission', 2, 'delete_permission'),
(8, 'Can view permission', 2, 'view_permission'),
(9, 'Can add group', 3, 'add_group'),
(10, 'Can change group', 3, 'change_group'),
(11, 'Can delete group', 3, 'delete_group'),
(12, 'Can view group', 3, 'view_group'),
(13, 'Can add content type', 4, 'add_contenttype'),
(14, 'Can change content type', 4, 'change_contenttype'),
(15, 'Can delete content type', 4, 'delete_contenttype'),
(16, 'Can view content type', 4, 'view_contenttype'),
(17, 'Can add session', 5, 'add_session'),
(18, 'Can change session', 5, 'change_session'),
(19, 'Can delete session', 5, 'delete_session'),
(20, 'Can view session', 5, 'view_session'),
(21, 'Can add user', 6, 'add_user'),
(22, 'Can change user', 6, 'change_user'),
(23, 'Can delete user', 6, 'delete_user'),
(24, 'Can view user', 6, 'view_user'),
(25, 'Can add permission', 7, 'add_permission'),
(26, 'Can change permission', 7, 'change_permission'),
(27, 'Can delete permission', 7, 'delete_permission'),
(28, 'Can view permission', 7, 'view_permission'),
(29, 'Can add role', 8, 'add_role'),
(30, 'Can change role', 8, 'change_role'),
(31, 'Can delete role', 8, 'delete_role'),
(32, 'Can view role', 8, 'view_role'),
(33, 'Can add user permission', 9, 'add_userpermission'),
(34, 'Can change user permission', 9, 'change_userpermission'),
(35, 'Can delete user permission', 9, 'delete_userpermission'),
(36, 'Can view user permission', 9, 'view_userpermission'),
(37, 'Can add role permission', 10, 'add_rolepermission'),
(38, 'Can change role permission', 10, 'change_rolepermission'),
(39, 'Can delete role permission', 10, 'delete_rolepermission'),
(40, 'Can view role permission', 10, 'view_rolepermission'),
(41, 'Can add dashboard session', 11, 'add_dashboardsession'),
(42, 'Can change dashboard session', 11, 'change_dashboardsession'),
(43, 'Can delete dashboard session', 11, 'delete_dashboardsession'),
(44, 'Can view dashboard session', 11, 'view_dashboardsession'),
(45, 'Can add client revenue target', 12, 'add_clientrevenuetarget'),
(46, 'Can change client revenue target', 12, 'change_clientrevenuetarget'),
(47, 'Can delete client revenue target', 12, 'delete_clientrevenuetarget'),
(48, 'Can view client revenue target', 12, 'view_clientrevenuetarget'),
(49, 'Can add client kpi target override', 13, 'add_clientkpitargetoverride'),
(50, 'Can change client kpi target override', 13, 'change_clientkpitargetoverride'),
(51, 'Can delete client kpi target override', 13, 'delete_clientkpitargetoverride'),
(52, 'Can view client kpi target override', 13, 'view_clientkpitargetoverride'),
(53, 'Can add client gp threshold', 14, 'add_clientgpthreshold'),
(54, 'Can change client gp threshold', 14, 'change_clientgpthreshold'),
(55, 'Can delete client gp threshold', 14, 'delete_clientgpthreshold'),
(56, 'Can view client gp threshold', 14, 'view_clientgpthreshold'),
(57, 'Can add client', 15, 'add_client'),
(58, 'Can change client', 15, 'change_client'),
(59, 'Can delete client', 15, 'delete_client'),
(60, 'Can view client', 15, 'view_client'),
(61, 'Can add client user membership', 16, 'add_clientusermembership'),
(62, 'Can change client user membership', 16, 'change_clientusermembership'),
(63, 'Can delete client user membership', 16, 'delete_clientusermembership'),
(64, 'Can view client user membership', 16, 'view_clientusermembership'),
(65, 'Can add client branch', 17, 'add_clientbranch'),
(66, 'Can change client branch', 17, 'change_clientbranch'),
(67, 'Can delete client branch', 17, 'delete_clientbranch'),
(68, 'Can view client branch', 17, 'view_clientbranch');

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

--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` bigint(20) NOT NULL,
  `name` varchar(120) NOT NULL,
  `slug` varchar(120) NOT NULL,
  `is_active` tinyint(1) NOT NULL,
  `created_at` datetime(6) NOT NULL,
  `updated_at` datetime(6) NOT NULL,
  `subdomain` varchar(120) DEFAULT NULL,
  `use_demo_data` tinyint(1) NOT NULL,
  `xero_oauth_client_id` varchar(120) NOT NULL,
  `xero_oauth_client_secret` longtext NOT NULL,
  `xero_oauth_refresh_token` longtext NOT NULL,
  `features` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`features`)),
  `company_display_name` varchar(200) NOT NULL,
  `logo` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `clients`
--

INSERT INTO `clients` (`id`, `name`, `slug`, `is_active`, `created_at`, `updated_at`, `subdomain`, `use_demo_data`, `xero_oauth_client_id`, `xero_oauth_client_secret`, `xero_oauth_refresh_token`, `features`, `company_display_name`, `logo`) VALUES
(1, 'Nixon', 'nixon', 1, '2026-04-28 16:39:49.222265', '2026-04-28 20:55:27.043501', 'nixon', 0, '', '', '', '{\"job_efficiency_csv\": true}', '', 'client_logos/2026/04/nixon-live-logo.png');

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

--
-- Table structure for table `client_branches`
--

CREATE TABLE `client_branches` (
  `id` bigint(20) NOT NULL,
  `branch_id` varchar(50) NOT NULL,
  `branch_name` varchar(100) NOT NULL,
  `simpro_api_url` varchar(255) NOT NULL,
  `simpro_api_key` varchar(255) NOT NULL,
  `xero_enabled` tinyint(1) NOT NULL,
  `xero_tenant_id` varchar(120) NOT NULL,
  `xero_tracking_category_name` varchar(120) NOT NULL,
  `xero_department_to_option` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`xero_department_to_option`)),
  `xero_department_to_company_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`xero_department_to_company_id`)),
  `created_at` datetime(6) NOT NULL,
  `updated_at` datetime(6) NOT NULL,
  `client_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `client_branches`
--

INSERT INTO `client_branches` (`id`, `branch_id`, `branch_name`, `simpro_api_url`, `simpro_api_key`, `xero_enabled`, `xero_tenant_id`, `xero_tracking_category_name`, `xero_department_to_option`, `xero_department_to_company_id`, `created_at`, `updated_at`, `client_id`) VALUES
(1, 'branch1', 'Busselton', 'https://nixonbusselton.simprosuite.com/api/v1.0', '228a4be783673afb707e4f7ebf1c28d308dfed1a', 1, 'ab5dc0f1-183d-47f3-a8ce-ce2113b0f016', 'Business Groups', '{\"Electrical\": \"Residential\", \"Air\": \"Air Conditioning\"}', '{\"Electrical\": 139, \"Air\": 172}', '2026-04-28 16:39:49.230944', '2026-04-28 16:39:49.232036', 1),
(2, 'branch2', 'Bunbury', 'https://nixonelectrics.simprosuite.com/api/v1.0', 'b1f40f7899b639b703f5a162f4af2517dbe7bd14', 1, '2f48b22d-58ee-40a1-a2bd-4525bbab90ef', 'Business Groups', '{\"Residential\": \"Residential\", \"Air\": \"Air Conditioning\", \"Solar\": \"Solar\", \"Commercial\": \"Commercial\"}', '{\"Residential\": 2, \"Air\": 3, \"Solar\": 4, \"Commercial\": 5}', '2026-04-28 16:39:49.233958', '2026-04-28 16:39:49.235173', 1),
(3, 'branch3', 'Mandurah', 'https://nixonmandurah.simprosuite.com/api/v1.0', '1270e156446bc9881bf58a9898697e0c9e87030c', 1, '4e0dc72c-f625-4d93-b1cd-1b321d90fe87', 'Business Groups', '{\"Electrical\": [\"Commercial\", \"Residential\"], \"Air\": \"Air Conditioning\"}', '{\"Electrical\": 2, \"Air\": 35}', '2026-04-28 16:39:49.236877', '2026-04-28 16:39:49.237711', 1);

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

--
-- Table structure for table `client_gp_thresholds`
--

CREATE TABLE `client_gp_thresholds` (
  `id` bigint(20) NOT NULL,
  `department_type` varchar(50) NOT NULL,
  `green_min` double NOT NULL,
  `yellow_min` double NOT NULL,
  `yellow_max` double NOT NULL,
  `red_max` double NOT NULL,
  `updated_at` datetime(6) NOT NULL,
  `client_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `client_kpi_target_overrides`
--

CREATE TABLE `client_kpi_target_overrides` (
  `id` bigint(20) NOT NULL,
  `branch` varchar(80) NOT NULL,
  `department` varchar(80) NOT NULL,
  `metric_key` varchar(80) NOT NULL,
  `target` double DEFAULT NULL,
  `weight` double DEFAULT NULL,
  `updated_at` datetime(6) NOT NULL,
  `client_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `client_revenue_targets`
--

CREATE TABLE `client_revenue_targets` (
  `id` bigint(20) NOT NULL,
  `branch_id` varchar(50) NOT NULL,
  `company_id` int(11) NOT NULL,
  `target` int(11) DEFAULT NULL,
  `breakeven` int(11) DEFAULT NULL,
  `updated_at` datetime(6) NOT NULL,
  `client_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `client_user_memberships`
--

CREATE TABLE `client_user_memberships` (
  `id` bigint(20) NOT NULL,
  `is_active` tinyint(1) NOT NULL,
  `created_at` datetime(6) NOT NULL,
  `client_id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `client_user_memberships`
--

INSERT INTO `client_user_memberships` (`id`, `is_active`, `created_at`, `client_id`, `user_id`) VALUES
(1, 1, '2026-04-28 16:39:49.240658', 1, 2),
(2, 1, '2026-04-28 16:39:49.242314', 1, 12),
(3, 1, '2026-04-28 16:39:49.243992', 1, 17),
(4, 1, '2026-04-28 16:39:49.245628', 1, 18),
(5, 1, '2026-04-28 16:39:49.247242', 1, 20),
(6, 1, '2026-04-28 16:39:49.248854', 1, 21),
(7, 1, '2026-04-28 16:39:49.250427', 1, 22),
(8, 1, '2026-04-28 16:39:49.252067', 1, 23),
(9, 1, '2026-04-28 16:39:49.253654', 1, 24),
(10, 1, '2026-04-28 16:39:49.255225', 1, 25),
(11, 1, '2026-04-28 16:39:49.256767', 1, 27),
(12, 1, '2026-04-28 16:39:49.258286', 1, 28),
(13, 1, '2026-04-28 16:39:49.259933', 1, 29),
(14, 1, '2026-04-28 16:39:49.261570', 1, 30),
(15, 1, '2026-04-28 16:39:49.262973', 1, 31),
(16, 1, '2026-04-28 16:39:49.264588', 1, 32),
(17, 1, '2026-04-28 16:39:49.266271', 1, 33),
(18, 1, '2026-04-28 16:39:49.267880', 1, 34),
(19, 1, '2026-04-28 16:39:49.269476', 1, 35),
(20, 1, '2026-04-28 16:39:49.271082', 1, 36),
(21, 1, '2026-04-28 16:39:49.272660', 1, 37),
(22, 1, '2026-04-28 16:39:49.274145', 1, 39);

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

--
-- Table structure for table `django_admin_log`
--

CREATE TABLE `django_admin_log` (
  `id` int(11) NOT NULL,
  `action_time` datetime(6) NOT NULL,
  `object_id` longtext DEFAULT NULL,
  `object_repr` varchar(200) NOT NULL,
  `action_flag` smallint(5) UNSIGNED NOT NULL CHECK (`action_flag` >= 0),
  `change_message` longtext NOT NULL,
  `content_type_id` int(11) DEFAULT NULL,
  `user_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `django_content_type`
--

CREATE TABLE `django_content_type` (
  `id` int(11) NOT NULL,
  `app_label` varchar(100) NOT NULL,
  `model` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `django_content_type`
--

INSERT INTO `django_content_type` (`id`, `app_label`, `model`) VALUES
(11, 'accounts', 'dashboardsession'),
(7, 'accounts', 'permission'),
(8, 'accounts', 'role'),
(10, 'accounts', 'rolepermission'),
(6, 'accounts', 'user'),
(9, 'accounts', 'userpermission'),
(1, 'admin', 'logentry'),
(3, 'auth', 'group'),
(2, 'auth', 'permission'),
(4, 'contenttypes', 'contenttype'),
(14, 'dashboard_api', 'clientgpthreshold'),
(13, 'dashboard_api', 'clientkpitargetoverride'),
(12, 'dashboard_api', 'clientrevenuetarget'),
(15, 'integrations', 'client'),
(17, 'integrations', 'clientbranch'),
(16, 'integrations', 'clientusermembership'),
(5, 'sessions', 'session');

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

--
-- Table structure for table `django_migrations`
--

CREATE TABLE `django_migrations` (
  `id` bigint(20) NOT NULL,
  `app` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `applied` datetime(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `django_migrations`
--

INSERT INTO `django_migrations` (`id`, `app`, `name`, `applied`) VALUES
(1, 'contenttypes', '0001_initial', '2026-04-28 16:33:59.864531'),
(2, 'contenttypes', '0002_remove_content_type_name', '2026-04-28 16:33:59.884335'),
(3, 'auth', '0001_initial', '2026-04-28 16:33:59.927726'),
(4, 'auth', '0002_alter_permission_name_max_length', '2026-04-28 16:33:59.936348'),
(5, 'auth', '0003_alter_user_email_max_length', '2026-04-28 16:33:59.939474'),
(6, 'auth', '0004_alter_user_username_opts', '2026-04-28 16:33:59.943443'),
(7, 'auth', '0005_alter_user_last_login_null', '2026-04-28 16:33:59.946206'),
(8, 'auth', '0006_require_contenttypes_0002', '2026-04-28 16:33:59.947173'),
(9, 'auth', '0007_alter_validators_add_error_messages', '2026-04-28 16:33:59.949873'),
(10, 'auth', '0008_alter_user_username_max_length', '2026-04-28 16:33:59.952707'),
(11, 'auth', '0009_alter_user_last_name_max_length', '2026-04-28 16:33:59.955679'),
(12, 'auth', '0010_alter_group_name_max_length', '2026-04-28 16:33:59.961547'),
(13, 'auth', '0011_update_proxy_permissions', '2026-04-28 16:33:59.964786'),
(14, 'auth', '0012_alter_user_first_name_max_length', '2026-04-28 16:33:59.967796'),
(15, 'accounts', '0001_initial', '2026-04-28 16:34:00.178485'),
(17, 'admin', '0001_initial', '2026-04-28 16:34:00.208319'),
(18, 'admin', '0002_logentry_remove_auto_add', '2026-04-28 16:34:00.215178'),
(19, 'admin', '0003_logentry_add_action_flag_choices', '2026-04-28 16:34:00.220719'),
(20, 'integrations', '0001_initial', '2026-04-28 16:34:00.269347'),
(21, 'dashboard_api', '0001_initial', '2026-04-28 16:34:00.327291'),
(22, 'integrations', '0002_client_subdomain', '2026-04-28 16:34:00.338475'),
(23, 'integrations', '0003_client_use_demo_data', '2026-04-28 16:34:00.348540'),
(24, 'integrations', '0004_client_xero_oauth_and_features', '2026-04-28 16:34:00.395392'),
(25, 'integrations', '0005_client_branding', '2026-04-28 16:34:00.412009'),
(26, 'sessions', '0001_initial', '2026-04-28 16:34:00.422437'),
(27, 'accounts', '0002_legacy_mysql_user_extras', '2026-04-28 16:34:31.800402');

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

--
-- Table structure for table `django_session`
--

CREATE TABLE `django_session` (
  `session_key` varchar(40) NOT NULL,
  `session_data` longtext NOT NULL,
  `expire_date` datetime(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) NOT NULL,
  `key` varchar(80) NOT NULL,
  `name` varchar(120) NOT NULL,
  `category` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `key`, `name`, `category`) VALUES
(1, 'admin.access', 'Access Admin page', 'Admin'),
(2, 'admin.revenue_targets', 'Revenue targets (admin)', 'Admin'),
(3, 'admin.gp_thresholds', 'GP thresholds (admin)', 'Admin'),
(4, 'admin.kpi_targets', 'KPI targets (admin)', 'Admin'),
(5, 'admin.connections', 'Connections (admin)', 'Admin'),
(6, 'admin.users', 'Users list & create (admin)', 'Admin'),
(7, 'admin.manage_roles', 'Manage roles & permissions (admin)', 'Admin'),
(8, 'directors.access', 'Access Directors page', 'Directors'),
(9, 'branch.overview', 'Overview (company)', 'Branches'),
(10, 'branch.branch1', 'Busselton branch', 'Branches'),
(11, 'branch.branch2', 'Bunbury branch', 'Branches'),
(12, 'branch.branch3', 'Mandurah branch', 'Branches'),
(13, 'department.branch1_electrical', 'Busselton Electrical', 'Departments'),
(14, 'department.branch1_air', 'Busselton Air', 'Departments'),
(15, 'department.branch2_residential', 'Bunbury Residential', 'Departments'),
(16, 'department.branch2_air', 'Bunbury Air', 'Departments'),
(17, 'department.branch2_solar', 'Bunbury Solar', 'Departments'),
(18, 'department.branch2_commercial', 'Bunbury Commercial', 'Departments'),
(19, 'department.branch3_electrical', 'Mandurah Electrical', 'Departments'),
(20, 'department.branch3_air', 'Mandurah Air', 'Departments'),
(21, 'kpi.branch1', 'Busselton KPIs only', 'KPIs'),
(22, 'kpi.branch2', 'Bunbury KPIs only', 'KPIs'),
(23, 'kpi.branch3', 'Mandurah KPIs only', 'KPIs'),
(24, 'performance.access', 'Access Performance Monitor', 'Performance'),
(25, 'admin.custom_pages', 'Custom page builder', 'Admin');

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) NOT NULL,
  `name` varchar(60) NOT NULL,
  `slug` varchar(20) DEFAULT NULL,
  `is_system` tinyint(1) NOT NULL,
  `created_at` datetime(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `slug`, `is_system`, `created_at`) VALUES
(1, 'User', 'user', 1, '2026-04-28 16:34:01.038865'),
(2, 'Admin', 'admin', 1, '2026-04-28 16:34:01.040375'),
(3, 'Director', 'director', 1, '2026-04-28 16:34:01.041485');

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

--
-- Table structure for table `role_permissions`
--

CREATE TABLE `role_permissions` (
  `id` bigint(20) NOT NULL,
  `permission_id` bigint(20) NOT NULL,
  `role_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` bigint(20) NOT NULL,
  `token` varchar(64) NOT NULL,
  `expires_at` datetime(6) NOT NULL,
  `remember_me` tinyint(1) NOT NULL,
  `created_at` datetime(6) NOT NULL,
  `otp_verified_at` datetime(6) DEFAULT NULL,
  `otp_code_hash` varchar(255) DEFAULT NULL,
  `otp_expires_at` datetime(6) DEFAULT NULL,
  `user_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `token`, `expires_at`, `remember_me`, `created_at`, `otp_verified_at`, `otp_code_hash`, `otp_expires_at`, `user_id`) VALUES
(1, 'tmOnxmdNkvS6J8WS7idYsvcmHQBf3rMt-PVIb9kWLeo', '2026-05-05 16:41:05.123199', 0, '2026-04-28 16:41:05.123368', '2026-04-28 16:41:05.123199', NULL, NULL, 12),
(4, 'YoGAomus5lHBTNeIfwrYoDe1_MorfCBl45YwbNHCsqM', '2026-05-05 20:53:59.573690', 0, '2026-04-28 20:53:59.573821', '2026-04-28 20:53:59.573690', NULL, NULL, 12),
(7, 'UJuLKuujvauzti1vK7-GRoRQ9A_GApKPc3haPZrD6tg', '2026-05-05 22:15:07.929329', 0, '2026-04-28 22:15:07.929463', '2026-04-28 22:15:07.929329', NULL, NULL, 31),
(11, '4m3yZRMzZDDuUvVztKiBg4ngRCJkflmfVFT-CnOsWVA', '2026-05-06 00:48:13.704571', 0, '2026-04-29 00:48:13.704658', '2026-04-29 00:48:13.704571', NULL, NULL, 27),
(12, 'xBavsViadX7zjtIglErSCrEYLJJzb6wjeRJoq1q6cBM', '2026-05-29 04:39:51.456588', 1, '2026-04-29 04:39:51.456690', '2026-04-29 04:39:51.456588', NULL, NULL, 2),
(13, 'aSS0UhuLjamyyteDTPoKMl4QqxY0nKF52Brw0pT8w_w', '2026-05-06 05:37:33.186772', 0, '2026-04-29 05:37:33.186872', '2026-04-29 05:37:33.186772', NULL, NULL, 12);

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL,
  `last_login` datetime(6) DEFAULT NULL,
  `is_superuser` tinyint(1) NOT NULL,
  `username` varchar(80) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `role` varchar(20) NOT NULL,
  `created_at` datetime(6) NOT NULL,
  `invite_token` varchar(64) DEFAULT NULL,
  `invite_expires_at` datetime(6) DEFAULT NULL,
  `reset_token` varchar(64) DEFAULT NULL,
  `reset_expires_at` datetime(6) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL,
  `is_staff` tinyint(1) NOT NULL,
  `role_id` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `last_login`, `is_superuser`, `username`, `password_hash`, `role`, `created_at`, `invite_token`, `invite_expires_at`, `reset_token`, `reset_expires_at`, `is_active`, `is_staff`, `role_id`) VALUES
(2, NULL, 0, 'dylan@nixonlive.com.au', '$2a$12$Hi5UV/bQYZx0LnGA9xFdHu.ml3F5tIvvwKOTsPLB/XzLCzNDb5Yza', 'director', '2026-04-28 20:45:23.857856', NULL, NULL, NULL, NULL, 1, 1, 3),
(12, NULL, 0, 'adam@nixonlive.com.au', '$2b$12$WM4pBeD3lcvblAB1/m9EdObsp1tuzB3W2IWGuZBXKCGJ06Scwa9vK', 'user', '2026-02-24 01:26:39.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(17, NULL, 0, 'rachel@nixonlive.com.au', '$2b$12$QYeO7l75EZO4732Zyg.u9.sMKbd6pykyKDQzXnq8NtpuN4NAdNa4.', 'user', '2026-02-24 02:59:12.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(18, NULL, 0, 'test', '$2b$12$K4TwLg5F/5xO9gqHFSu0JeqUaqUhBnbpkWSvHl6Dm6sfbdTSXkrwK', 'user', '2026-02-24 03:05:16.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(20, NULL, 0, 'hayden@nixonlive.com.au', '$2b$12$91Z2uqz52GrPPHrc5KJLTuMlAQAgcKTVT9.IjUUdwRN5hgVXnYCEC', 'user', '2026-02-24 03:11:08.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(21, NULL, 0, 'ryan@nixonlive.com.au', '$2b$12$jD4NKwwTJhSzIVjxrXW8o.FneH4n2x6ZkQ3Z7tSYAxPIV4yxIZYEG', 'user', '2026-02-24 03:11:35.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(22, NULL, 0, 'tom@nixonlive.com.au', '$2b$12$idNbgBQ86zsMS1.Ymm9KYujIEU6m72zEIfI.NNiexI///4TpsRKPy', 'user', '2026-02-24 03:11:51.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(23, NULL, 0, 'tony@nixonlive.com.au', '$2b$12$mwnrAL/cNAtuXkDtRIvrrOG5ohgmJqMAivR8fWwbLv0p5oXh/8cIq', 'user', '2026-02-24 03:12:13.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(24, NULL, 0, 'sean.browne@nixonlive.com.au', '$2b$12$dNxSHuXDx4.Dl7g0YlxnpOAascGBa53mFyqbolLJQIaorV6n0X7bu', 'user', '2026-02-24 03:12:32.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(25, NULL, 0, 'jamie@nixonlive.com.au', '$2b$12$wQtVPygr4.ytHQa0mTPggez6jQ/w7zqlC95NoWDRIbqb1srhWNtxu', 'user', '2026-02-24 03:12:52.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(27, NULL, 0, 'keegan@nixonlive.com.au', '$2b$12$4Xl2kLYfhrhJwDJOYr6Qr.R5dsgqExZMWMsFhwoAZ6/LJKGZ3MZvS', 'user', '2026-02-24 03:13:44.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(28, NULL, 0, 'dave@nixonlive.com.au', '$2b$12$DMlCxIWhZiM5ykuuhv6GCusYYIUWJaDzHq2ycTX2GT5xrWhMBkHqi', 'user', '2026-02-24 03:14:42.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(29, NULL, 0, 'jay@nixonlive.com.au', '$2b$12$wq01ZIMS1P1gg5zWONW.beUQP6qV6m19DN2cPkg.6mJnKs8UiypzW', 'user', '2026-02-24 03:15:39.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(30, NULL, 0, 'mitch@nixonlive.com.au', '$2b$12$WFQCOOtYcf9gSzzLwk7su.2SkA0.H1GQZFubMbw5mOUU9J3Lhoab.', 'user', '2026-02-24 03:16:21.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(31, NULL, 0, 'tristan@nixonlive.com.au', '$2b$12$sptBXpzQX8x0vLJRnujgeelEPLFgt8lK45LmSP2j/VDnd2c2OqINW', 'user', '2026-02-24 03:16:53.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(32, NULL, 0, 'teneale@nixonlive.com.au', '$2b$12$2bsKqBAKYo0VF1Sd8HXGDeSQt2EQx5rfRZS3f9tsuvjUfuOZMLSm.', 'user', '2026-02-24 03:17:49.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(33, NULL, 0, 'andrewm@the-entourage.com', '$2b$12$KpWhCCJeF7.E7moEx89vGul3J1qKtgHVF64x8AHiQ6kfQYO7zQRsW', 'user', '2026-02-25 06:13:35.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(34, NULL, 0, 'darren@nixonlive.com.au', '$2b$12$fB9fqm8PcbBQAxl7slhbMeyNliGXmeGhCZfmx7LV3DdCCvPnw14Ea', 'user', '2026-02-25 07:21:20.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(35, NULL, 0, 'busselton@nixonlive.com.au', '$2b$12$z88BAuKvxh5kPvQ1Y/6ZGue9tyZS1WQJn9hQJhlv6VbYWBtomDOxS', 'user', '2026-02-26 04:13:23.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(36, NULL, 0, 'bunbury@nixonlive.com.au', '$2b$12$c2f6fQbf6uNcTLI19eq57ejk.epESFsg1ufyefdmNE1paYNhyqKW6', 'user', '2026-02-26 04:14:39.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(37, NULL, 0, 'mandurah@nixonlive.com.au', '$2b$12$fHjQBNdH1NjvJmM5CO7rPehc.KfUemurv6lHCoZEqrV1KoGNLME6u', 'user', '2026-02-26 04:15:16.000000', NULL, NULL, NULL, NULL, 1, 0, 1),
(39, NULL, 0, 'cherrie@nixonlive.com.au', '$2b$12$PM9VulPA142aTYGLjaoYN./k3/fsyeXhis7a0EOzhXAqpWvn9Qija', 'user', '2026-04-28 05:07:28.000000', NULL, NULL, NULL, NULL, 1, 0, 1);

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

--
-- Table structure for table `users_groups`
--

CREATE TABLE `users_groups` (
  `id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `group_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `users_user_permissions`
--

CREATE TABLE `users_user_permissions` (
  `id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `permission_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_permissions`
--

CREATE TABLE `user_permissions` (
  `id` bigint(20) NOT NULL,
  `permission_id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_permissions`
--

INSERT INTO `user_permissions` (`id`, `permission_id`, `user_id`) VALUES
(1, 1, 2),
(2, 2, 2),
(3, 3, 2),
(4, 4, 2),
(5, 5, 2),
(6, 6, 2),
(7, 7, 2),
(8, 8, 2),
(9, 9, 2),
(10, 10, 2),
(11, 11, 2),
(12, 12, 2),
(13, 13, 2),
(14, 14, 2),
(15, 15, 2),
(16, 16, 2),
(17, 17, 2),
(18, 18, 2),
(19, 19, 2),
(20, 20, 2),
(21, 1, 12),
(22, 2, 12),
(23, 3, 12),
(24, 4, 12),
(25, 5, 12),
(26, 6, 12),
(27, 7, 12),
(28, 8, 12),
(29, 9, 12),
(30, 10, 12),
(31, 11, 12),
(32, 12, 12),
(33, 13, 12),
(34, 14, 12),
(35, 15, 12),
(36, 16, 12),
(37, 17, 12),
(38, 18, 12),
(39, 19, 12),
(40, 20, 12),
(41, 10, 17),
(42, 14, 17),
(43, 10, 18),
(44, 21, 18),
(45, 10, 20),
(46, 13, 20),
(47, 14, 20),
(48, 11, 21),
(49, 15, 21),
(50, 11, 22),
(51, 16, 22),
(52, 11, 23),
(53, 18, 23),
(54, 12, 24),
(55, 19, 24),
(56, 12, 25),
(57, 20, 25),
(58, 11, 27),
(59, 18, 27),
(60, 8, 28),
(61, 9, 28),
(62, 10, 28),
(63, 11, 28),
(64, 12, 28),
(65, 13, 28),
(66, 14, 28),
(67, 15, 28),
(68, 16, 28),
(69, 17, 28),
(70, 18, 28),
(71, 19, 28),
(72, 20, 28),
(73, 8, 29),
(74, 9, 29),
(75, 10, 29),
(76, 11, 29),
(77, 12, 29),
(78, 13, 29),
(79, 14, 29),
(80, 15, 29),
(81, 16, 29),
(82, 17, 29),
(83, 18, 29),
(84, 19, 29),
(85, 20, 29),
(86, 8, 30),
(87, 9, 30),
(88, 10, 30),
(89, 11, 30),
(90, 12, 30),
(91, 13, 30),
(92, 14, 30),
(93, 15, 30),
(94, 16, 30),
(95, 17, 30),
(96, 18, 30),
(97, 19, 30),
(98, 20, 30),
(99, 12, 31),
(100, 19, 31),
(101, 20, 31),
(102, 11, 32),
(103, 15, 32),
(104, 16, 32),
(105, 17, 32),
(106, 18, 32),
(107, 8, 33),
(108, 9, 33),
(109, 10, 33),
(110, 11, 33),
(111, 12, 33),
(112, 13, 33),
(113, 14, 33),
(114, 15, 33),
(115, 16, 33),
(116, 17, 33),
(117, 18, 33),
(118, 19, 33),
(119, 20, 33),
(120, 11, 34),
(121, 17, 34),
(122, 10, 35),
(123, 21, 35),
(124, 11, 36),
(125, 22, 36),
(126, 12, 37),
(127, 23, 37),
(128, 11, 39),
(129, 17, 39);

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `auth_group_permissions`
--
ALTER TABLE `auth_group_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),
  ADD KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`);

--
-- Indexes for table `auth_permission`
--
ALTER TABLE `auth_permission`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`);

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD UNIQUE KEY `slug` (`slug`),
  ADD UNIQUE KEY `subdomain` (`subdomain`);

--
-- Indexes for table `client_branches`
--
ALTER TABLE `client_branches`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_branches_client_id_branch_id_a66ad967_uniq` (`client_id`,`branch_id`);

--
-- Indexes for table `client_gp_thresholds`
--
ALTER TABLE `client_gp_thresholds`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_gp_thresholds_client_id_department_type_a594316f_uniq` (`client_id`,`department_type`);

--
-- Indexes for table `client_kpi_target_overrides`
--
ALTER TABLE `client_kpi_target_overrides`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_kpi_target_overri_client_id_branch_departm_9def5971_uniq` (`client_id`,`branch`,`department`,`metric_key`);

--
-- Indexes for table `client_revenue_targets`
--
ALTER TABLE `client_revenue_targets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_revenue_targets_client_id_branch_id_comp_07d98757_uniq` (`client_id`,`branch_id`,`company_id`);

--
-- Indexes for table `client_user_memberships`
--
ALTER TABLE `client_user_memberships`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_user_memberships_client_id_user_id_0bbb23c1_uniq` (`client_id`,`user_id`),
  ADD KEY `client_user_memberships_user_id_be0102d4_fk_users_id` (`user_id`);

--
-- Indexes for table `django_admin_log`
--
ALTER TABLE `django_admin_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`),
  ADD KEY `django_admin_log_user_id_c564eba6_fk_users_id` (`user_id`);

--
-- Indexes for table `django_content_type`
--
ALTER TABLE `django_content_type`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`);

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

--
-- Indexes for table `django_session`
--
ALTER TABLE `django_session`
  ADD PRIMARY KEY (`session_key`),
  ADD KEY `django_session_expire_date_a5c62663` (`expire_date`);

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

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `slug` (`slug`);

--
-- Indexes for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `role_permissions_role_id_permission_id_04f77df0_uniq` (`role_id`,`permission_id`),
  ADD KEY `role_permissions_permission_id_ad343843_fk_permissions_id` (`permission_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `token` (`token`),
  ADD KEY `sessions_user_id_05e26f4a_fk_users_id` (`user_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `invite_token` (`invite_token`),
  ADD UNIQUE KEY `reset_token` (`reset_token`),
  ADD KEY `users_role_id_1900a745_fk_roles_id` (`role_id`);

--
-- Indexes for table `users_groups`
--
ALTER TABLE `users_groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_groups_user_id_group_id_fc7788e8_uniq` (`user_id`,`group_id`),
  ADD KEY `users_groups_group_id_2f3517aa_fk_auth_group_id` (`group_id`);

--
-- Indexes for table `users_user_permissions`
--
ALTER TABLE `users_user_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_user_permissions_user_id_permission_id_3b86cbdf_uniq` (`user_id`,`permission_id`),
  ADD KEY `users_user_permissio_permission_id_6d08dcd2_fk_auth_perm` (`permission_id`);

--
-- Indexes for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_permissions_user_id_permission_id_11a83645_uniq` (`user_id`,`permission_id`),
  ADD KEY `user_permissions_permission_id_c566ae5c_fk_permissions_id` (`permission_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `auth_group_permissions`
--
ALTER TABLE `auth_group_permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `clients`
--
ALTER TABLE `clients`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `client_branches`
--
ALTER TABLE `client_branches`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `client_gp_thresholds`
--
ALTER TABLE `client_gp_thresholds`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `client_kpi_target_overrides`
--
ALTER TABLE `client_kpi_target_overrides`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `client_revenue_targets`
--
ALTER TABLE `client_revenue_targets`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `client_user_memberships`
--
ALTER TABLE `client_user_memberships`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

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

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

--
-- AUTO_INCREMENT for table `django_migrations`
--
ALTER TABLE `django_migrations`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `role_permissions`
--
ALTER TABLE `role_permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sessions`
--
ALTER TABLE `sessions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT for table `users_groups`
--
ALTER TABLE `users_groups`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users_user_permissions`
--
ALTER TABLE `users_user_permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_permissions`
--
ALTER TABLE `user_permissions`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=130;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `auth_group_permissions`
--
ALTER TABLE `auth_group_permissions`
  ADD CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
  ADD CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`);

--
-- Constraints for table `auth_permission`
--
ALTER TABLE `auth_permission`
  ADD CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);

--
-- Constraints for table `client_branches`
--
ALTER TABLE `client_branches`
  ADD CONSTRAINT `client_branches_client_id_390d94ab_fk_clients_id` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`);

--
-- Constraints for table `client_gp_thresholds`
--
ALTER TABLE `client_gp_thresholds`
  ADD CONSTRAINT `client_gp_thresholds_client_id_96b75e4b_fk_clients_id` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`);

--
-- Constraints for table `client_kpi_target_overrides`
--
ALTER TABLE `client_kpi_target_overrides`
  ADD CONSTRAINT `client_kpi_target_overrides_client_id_5e853716_fk_clients_id` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`);

--
-- Constraints for table `client_revenue_targets`
--
ALTER TABLE `client_revenue_targets`
  ADD CONSTRAINT `client_revenue_targets_client_id_19ceb6a5_fk_clients_id` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`);

--
-- Constraints for table `client_user_memberships`
--
ALTER TABLE `client_user_memberships`
  ADD CONSTRAINT `client_user_memberships_client_id_8196b433_fk_clients_id` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `client_user_memberships_user_id_be0102d4_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `django_admin_log`
--
ALTER TABLE `django_admin_log`
  ADD CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),
  ADD CONSTRAINT `django_admin_log_user_id_c564eba6_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD CONSTRAINT `role_permissions_permission_id_ad343843_fk_permissions_id` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`),
  ADD CONSTRAINT `role_permissions_role_id_216516f2_fk_roles_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);

--
-- Constraints for table `sessions`
--
ALTER TABLE `sessions`
  ADD CONSTRAINT `sessions_user_id_05e26f4a_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_role_id_1900a745_fk_roles_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);

--
-- Constraints for table `users_groups`
--
ALTER TABLE `users_groups`
  ADD CONSTRAINT `users_groups_group_id_2f3517aa_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
  ADD CONSTRAINT `users_groups_user_id_f500bee5_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `users_user_permissions`
--
ALTER TABLE `users_user_permissions`
  ADD CONSTRAINT `users_user_permissio_permission_id_6d08dcd2_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
  ADD CONSTRAINT `users_user_permissions_user_id_92473840_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD CONSTRAINT `user_permissions_permission_id_c566ae5c_fk_permissions_id` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`),
  ADD CONSTRAINT `user_permissions_user_id_b176ff97_fk_users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
