-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 02, 2026 at 05:25 PM
-- Server version: 10.3.39-MariaDB
-- PHP Version: 8.1.34

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: `latincon_api`
--

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

--
-- Table structure for table `api_keys`
--

CREATE TABLE `api_keys` (
  `id` int(11) UNSIGNED NOT NULL,
  `key_hash` varchar(64) NOT NULL COMMENT 'SHA-256 hash of the API key',
  `prefix` varchar(8) NOT NULL COMMENT 'First 8 chars for identification',
  `name` varchar(255) NOT NULL COMMENT 'Descriptive name for the key',
  `role` enum('master','admin','regular') NOT NULL DEFAULT 'regular',
  `password` varchar(255) DEFAULT NULL COMMENT 'Optional hashed password for key usage',
  `allowed_origins` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Allowed domains/IPs (null/empty = any, supports wildcards)',
  `created_by` int(11) UNSIGNED DEFAULT NULL COMMENT 'Parent key ID that created this key',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `expires_at` timestamp NULL DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `last_used_ip` varchar(45) DEFAULT NULL,
  `permissions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Granular permissions for regular keys',
  `rate_limit` int(11) UNSIGNED DEFAULT NULL COMMENT 'Requests per hour (null = default)',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customerlogos`
--

CREATE TABLE `cus__customerlogos` (
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `file` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customerregistrations`
--

CREATE TABLE `cus__customerregistrations` (
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `first` varchar(255) DEFAULT NULL,
  `last` varchar(255) DEFAULT NULL,
  `address1` varchar(255) DEFAULT NULL,
  `address2` varchar(255) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `region` varchar(50) DEFAULT NULL,
  `zip` varchar(15) DEFAULT NULL,
  `email` varchar(50) NOT NULL,
  `email2` varchar(50) DEFAULT NULL,
  `web` varchar(50) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `phone2` varchar(20) DEFAULT NULL,
  `focus` tinyint(3) UNSIGNED NOT NULL,
  `assocind` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `assochead` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `assocheadspec` varchar(50) DEFAULT NULL,
  `assoccoop` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `assoccoopspec` varchar(50) DEFAULT NULL,
  `assocfran` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `assocfranspec` varchar(50) DEFAULT NULL,
  `iata` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `iatanumber` varchar(25) DEFAULT NULL,
  `accepted` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `sentdate` date NOT NULL DEFAULT current_timestamp(),
  `approvedate` date DEFAULT NULL,
  `approveduser_id` smallint(5) UNSIGNED DEFAULT NULL,
  `note` longtext DEFAULT NULL,
  `notified` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `regmail` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customers`
--

CREATE TABLE `cus__customers` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `country_id` char(2) NOT NULL,
  `approved` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customer_dmcinterests`
--

CREATE TABLE `cus__customer_dmcinterests` (
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `dmc_id` tinyint(3) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customer_dmcrelations`
--

CREATE TABLE `cus__customer_dmcrelations` (
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `dmc_id` tinyint(3) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cus__customer_languages`
--

CREATE TABLE `cus__customer_languages` (
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `language_id` varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `dmccountries`
--

CREATE TABLE `dmccountries` (
  `id` char(3) NOT NULL,
  `name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `dmccountrydetails`
--

CREATE TABLE `dmccountrydetails` (
  `country_id` char(3) NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `dmcs`
--

CREATE TABLE `dmcs` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `name` varchar(45) NOT NULL,
  `domain` varchar(255) NOT NULL,
  `dmsdbhost` varchar(255) NOT NULL DEFAULT '',
  `dmsdbname` varchar(64) NOT NULL DEFAULT '''''',
  `dmsdbuser` varchar(80) NOT NULL DEFAULT '',
  `dmsdbpass` varchar(255) NOT NULL DEFAULT '',
  `memdbhost` varchar(255) NOT NULL DEFAULT '',
  `memdbname` varchar(64) NOT NULL DEFAULT '',
  `memdbuser` varchar(80) NOT NULL DEFAULT '',
  `memdbpass` varchar(255) NOT NULL DEFAULT '',
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `dmc_countries`
--

CREATE TABLE `dmc_countries` (
  `dmc_id` tinyint(3) UNSIGNED NOT NULL,
  `country_id` char(3) NOT NULL,
  `dmscountry_id` char(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `languages`
--

CREATE TABLE `languages` (
  `id` varchar(3) NOT NULL,
  `name` varchar(50) NOT NULL,
  `name_en` varchar(50) NOT NULL,
  `flag` varchar(50) DEFAULT NULL,
  `dmslanguage_id` tinyint(3) UNSIGNED DEFAULT NULL,
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `phinx_migrations`
--

CREATE TABLE `phinx_migrations` (
  `version` bigint(20) NOT NULL,
  `migration_name` varchar(100) DEFAULT NULL,
  `start_time` timestamp NULL DEFAULT NULL,
  `end_time` timestamp NULL DEFAULT NULL,
  `breakpoint` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `refresh_tokens`
--

CREATE TABLE `refresh_tokens` (
  `id` int(11) UNSIGNED NOT NULL,
  `api_key_id` int(11) UNSIGNED NOT NULL,
  `token_hash` varchar(64) NOT NULL COMMENT 'SHA-256 hash of the refresh token',
  `expires_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `revoked_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `ref__countries`
--

CREATE TABLE `ref__countries` (
  `id` char(2) NOT NULL,
  `cca3` char(3) NOT NULL,
  `currency_code` varchar(3) NOT NULL,
  `callingcode` varchar(7) NOT NULL,
  `region` varchar(8) NOT NULL,
  `subregion` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `ref__countrydetails`
--

CREATE TABLE `ref__countrydetails` (
  `country_id` char(2) NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `ref__nationalities`
--

CREATE TABLE `ref__nationalities` (
  `country_id` char(2) NOT NULL,
  `language_id` char(3) NOT NULL,
  `name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `src__productcache`
--

CREATE TABLE `src__productcache` (
  `id` int(10) UNSIGNED NOT NULL,
  `dmc_id` tinyint(3) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `service_id` tinyint(3) UNSIGNED NOT NULL,
  `country_id` char(3) NOT NULL,
  `region_id` smallint(5) UNSIGNED DEFAULT NULL,
  `location_id` smallint(5) UNSIGNED DEFAULT NULL,
  `name` varchar(120) NOT NULL,
  `comment` varchar(120) NOT NULL,
  `description` longtext NOT NULL,
  `tags` text NOT NULL,
  `searchamenities` text NOT NULL,
  `classification` tinyint(3) UNSIGNED NOT NULL,
  `recommended` tinyint(1) UNSIGNED NOT NULL,
  `detail` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `thumbnail` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `src__searchweights`
--

CREATE TABLE `src__searchweights` (
  `id` varchar(10) NOT NULL,
  `weight` tinyint(3) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `src__suppliercache`
--

CREATE TABLE `src__suppliercache` (
  `id` int(10) UNSIGNED NOT NULL,
  `dmc_id` tinyint(3) UNSIGNED NOT NULL,
  `supplier_id` smallint(5) UNSIGNED NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `service_id` tinyint(3) UNSIGNED NOT NULL,
  `country_id` char(3) NOT NULL,
  `region_id` smallint(5) UNSIGNED DEFAULT NULL,
  `location_id` smallint(5) UNSIGNED DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `description` longtext NOT NULL,
  `tags` text NOT NULL,
  `searchamenities` text NOT NULL,
  `classification` tinyint(3) UNSIGNED DEFAULT NULL,
  `recommended` tinyint(1) UNSIGNED NOT NULL,
  `detail` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `thumbnail` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `std__dmc_services`
--

CREATE TABLE `std__dmc_services` (
  `service_id` tinyint(3) UNSIGNED NOT NULL,
  `dmc_id` tinyint(3) UNSIGNED NOT NULL,
  `dmcservice_id` tinyint(3) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `std__servicedetails`
--

CREATE TABLE `std__servicedetails` (
  `service_id` tinyint(3) UNSIGNED NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `name` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `std__services`
--

CREATE TABLE `std__services` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `name` varchar(45) NOT NULL,
  `parent_id` tinyint(3) UNSIGNED DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `enabled` tinyint(1) NOT NULL DEFAULT 1,
  `lite` tinyint(1) NOT NULL DEFAULT 0,
  `supplier` tinyint(1) NOT NULL DEFAULT 1,
  `comment` tinyint(1) NOT NULL DEFAULT 0,
  `ifsupplier` tinyint(1) NOT NULL DEFAULT 0,
  `addservice` tinyint(1) UNSIGNED NOT NULL,
  `incservice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `ispickup` tinyint(1) UNSIGNED NOT NULL,
  `isdropoff` tinyint(1) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `api_keys`
--
ALTER TABLE `api_keys`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `idx_api_keys_hash` (`key_hash`),
  ADD UNIQUE KEY `idx_api_keys_prefix` (`prefix`),
  ADD KEY `idx_api_keys_role` (`role`),
  ADD KEY `idx_api_keys_creator` (`created_by`),
  ADD KEY `idx_api_keys_active` (`is_active`),
  ADD KEY `idx_api_keys_expires` (`expires_at`),
  ADD KEY `idx_api_keys_deleted` (`deleted_at`);

--
-- Indexes for table `cus__customerlogos`
--
ALTER TABLE `cus__customerlogos`
  ADD PRIMARY KEY (`customer_id`);

--
-- Indexes for table `cus__customerregistrations`
--
ALTER TABLE `cus__customerregistrations`
  ADD PRIMARY KEY (`customer_id`),
  ADD UNIQUE KEY `email_UNIQUE` (`email`),
  ADD KEY `referencecountry_id` (`referencecountry_id`);

--
-- Indexes for table `cus__customers`
--
ALTER TABLE `cus__customers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `country_id` (`country_id`);

--
-- Indexes for table `cus__customer_dmcinterests`
--
ALTER TABLE `cus__customer_dmcinterests`
  ADD PRIMARY KEY (`customer_id`,`dmc_id`),
  ADD KEY `dmc_id` (`dmc_id`);

--
-- Indexes for table `cus__customer_dmcrelations`
--
ALTER TABLE `cus__customer_dmcrelations`
  ADD PRIMARY KEY (`customer_id`,`dmc_id`),
  ADD KEY `dmc_id` (`dmc_id`);

--
-- Indexes for table `cus__customer_languages`
--
ALTER TABLE `cus__customer_languages`
  ADD PRIMARY KEY (`customer_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

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

--
-- Indexes for table `dmccountrydetails`
--
ALTER TABLE `dmccountrydetails`
  ADD PRIMARY KEY (`country_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

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

--
-- Indexes for table `dmc_countries`
--
ALTER TABLE `dmc_countries`
  ADD PRIMARY KEY (`dmc_id`,`country_id`),
  ADD KEY `country_id` (`country_id`),
  ADD KEY `dmscountry_id` (`dmscountry_id`);

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

--
-- Indexes for table `phinx_migrations`
--
ALTER TABLE `phinx_migrations`
  ADD PRIMARY KEY (`version`);

--
-- Indexes for table `refresh_tokens`
--
ALTER TABLE `refresh_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `idx_refresh_tokens_hash` (`token_hash`),
  ADD KEY `idx_refresh_tokens_api_key` (`api_key_id`),
  ADD KEY `idx_refresh_tokens_expires` (`expires_at`);

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

--
-- Indexes for table `ref__countrydetails`
--
ALTER TABLE `ref__countrydetails`
  ADD PRIMARY KEY (`country_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

--
-- Indexes for table `ref__nationalities`
--
ALTER TABLE `ref__nationalities`
  ADD PRIMARY KEY (`country_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

--
-- Indexes for table `src__productcache`
--
ALTER TABLE `src__productcache`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `dmc_id` (`dmc_id`,`product_id`,`language_id`),
  ADD KEY `service_id` (`service_id`),
  ADD KEY `country_id` (`country_id`),
  ADD KEY `region_id` (`region_id`),
  ADD KEY `location_id` (`location_id`),
  ADD KEY `classification` (`classification`),
  ADD KEY `recommended` (`recommended`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `name` (`name`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `comment` (`comment`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `description` (`description`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `tags` (`tags`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `searchamenities` (`searchamenities`);
ALTER TABLE `src__productcache` ADD FULLTEXT KEY `ft_search` (`name`,`comment`,`description`,`tags`,`searchamenities`);

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

--
-- Indexes for table `src__suppliercache`
--
ALTER TABLE `src__suppliercache`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `dmc_id` (`dmc_id`,`supplier_id`,`language_id`),
  ADD KEY `service_id` (`service_id`),
  ADD KEY `country_id` (`country_id`),
  ADD KEY `region_id` (`region_id`),
  ADD KEY `location_id` (`location_id`),
  ADD KEY `classification` (`classification`),
  ADD KEY `recommended` (`recommended`);
ALTER TABLE `src__suppliercache` ADD FULLTEXT KEY `name` (`name`);
ALTER TABLE `src__suppliercache` ADD FULLTEXT KEY `description` (`description`);
ALTER TABLE `src__suppliercache` ADD FULLTEXT KEY `tags` (`tags`);
ALTER TABLE `src__suppliercache` ADD FULLTEXT KEY `ft_search` (`name`,`description`,`tags`,`searchamenities`);
ALTER TABLE `src__suppliercache` ADD FULLTEXT KEY `searchamenities` (`searchamenities`);

--
-- Indexes for table `std__dmc_services`
--
ALTER TABLE `std__dmc_services`
  ADD PRIMARY KEY (`service_id`,`dmc_id`,`dmcservice_id`),
  ADD KEY `dmc_id` (`dmc_id`);

--
-- Indexes for table `std__servicedetails`
--
ALTER TABLE `std__servicedetails`
  ADD PRIMARY KEY (`service_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

--
-- Indexes for table `std__services`
--
ALTER TABLE `std__services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `parent_id` (`parent_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `cus__customers`
--
ALTER TABLE `cus__customers`
  MODIFY `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `dmcs`
--
ALTER TABLE `dmcs`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `src__productcache`
--
ALTER TABLE `src__productcache`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `src__suppliercache`
--
ALTER TABLE `src__suppliercache`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `std__services`
--
ALTER TABLE `std__services`
  MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `api_keys`
--
ALTER TABLE `api_keys`
  ADD CONSTRAINT `api_keys_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `api_keys` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `cus__customerlogos`
--
ALTER TABLE `cus__customerlogos`
  ADD CONSTRAINT `cus__customerlogos_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `cus__customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `cus__customerregistrations`
--
ALTER TABLE `cus__customerregistrations`
  ADD CONSTRAINT `cus__customerregistrations_ibfk_2` FOREIGN KEY (`referencecountry_id`) REFERENCES `ref__countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `cus__customerregistrations_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `cus__customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `cus__customers`
--
ALTER TABLE `cus__customers`
  ADD CONSTRAINT `cus__customers_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `ref__countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `cus__customer_dmcinterests`
--
ALTER TABLE `cus__customer_dmcinterests`
  ADD CONSTRAINT `cus__customer_dmcinterests_ibfk_2` FOREIGN KEY (`dmc_id`) REFERENCES `dmcs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `cus__customer_dmcinterests_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `cus__customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `cus__customer_dmcrelations`
--
ALTER TABLE `cus__customer_dmcrelations`
  ADD CONSTRAINT `cus__customer_dmcrelations_ibfk_2` FOREIGN KEY (`dmc_id`) REFERENCES `dmcs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `cus__customer_dmcrelations_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `cus__customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `cus__customer_languages`
--
ALTER TABLE `cus__customer_languages`
  ADD CONSTRAINT `cus__customer_languages_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `cus__customer_languages_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `cus__customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dmccountrydetails`
--
ALTER TABLE `dmccountrydetails`
  ADD CONSTRAINT `dmccountrydetails_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `dmccountries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dmccountrydetails_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dmc_countries`
--
ALTER TABLE `dmc_countries`
  ADD CONSTRAINT `dmc_countries_ibfk_1` FOREIGN KEY (`dmc_id`) REFERENCES `dmcs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dmc_countries_ibfk_2` FOREIGN KEY (`country_id`) REFERENCES `dmccountries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `refresh_tokens`
--
ALTER TABLE `refresh_tokens`
  ADD CONSTRAINT `refresh_tokens_ibfk_1` FOREIGN KEY (`api_key_id`) REFERENCES `api_keys` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `ref__countrydetails`
--
ALTER TABLE `ref__countrydetails`
  ADD CONSTRAINT `ref__countrydetails_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `ref__countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `ref__countrydetails_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `ref__nationalities`
--
ALTER TABLE `ref__nationalities`
  ADD CONSTRAINT `ref__nationalities_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `ref__countries` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `ref__nationalities_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `std__dmc_services`
--
ALTER TABLE `std__dmc_services`
  ADD CONSTRAINT `std__dmc_services_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `std__services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `std__dmc_services_ibfk_2` FOREIGN KEY (`dmc_id`) REFERENCES `dmcs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `std__servicedetails`
--
ALTER TABLE `std__servicedetails`
  ADD CONSTRAINT `std__servicedetails_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `std__servicedetails_ibfk_3` FOREIGN KEY (`service_id`) REFERENCES `std__services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `std__services`
--
ALTER TABLE `std__services`
  ADD CONSTRAINT `std__services_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `std__services` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
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 */;
