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

START TRANSACTION;



--
-- Database: `latincon_new`
--

DELIMITER $$
--
-- Procedures
--
$$

DELIMITER ;

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

--
-- Table structure for table `accesses`
--

CREATE TABLE `accesses` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) NOT NULL,
  `level` enum('SYS','DMC','CUS','') NOT NULL DEFAULT 'CUS'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactaddresses`
--

CREATE TABLE `contactaddresses` (
  `id` int(10) UNSIGNED NOT NULL,
  `contact_id` int(10) UNSIGNED NOT NULL,
  `contacttype_id` tinyint(3) UNSIGNED NOT NULL,
  `countries_id` char(2) NOT NULL,
  `addresslineone` varchar(255) DEFAULT NULL,
  `addresslinetwo` varchar(255) DEFAULT NULL,
  `zip` varchar(45) NOT NULL,
  `city` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactcompanies`
--

CREATE TABLE `contactcompanies` (
  `contact_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactemails`
--

CREATE TABLE `contactemails` (
  `id` int(10) UNSIGNED NOT NULL,
  `contact_id` int(10) UNSIGNED NOT NULL,
  `contacttype_id` tinyint(5) UNSIGNED NOT NULL,
  `emailaddress` varchar(254) NOT NULL,
  `defaultemail` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactpersons`
--

CREATE TABLE `contactpersons` (
  `contact_id` int(10) UNSIGNED NOT NULL,
  `firstname` varchar(120) NOT NULL,
  `lastname` varchar(45) DEFAULT NULL,
  `media_id` int(10) UNSIGNED DEFAULT NULL,
  `title` char(5) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactphones`
--

CREATE TABLE `contactphones` (
  `id` int(10) UNSIGNED NOT NULL,
  `contact_id` int(10) UNSIGNED NOT NULL,
  `contacttype_id` tinyint(3) UNSIGNED NOT NULL,
  `countrycode` varchar(7) NOT NULL,
  `number` varchar(15) DEFAULT NULL,
  `extension` smallint(6) DEFAULT NULL,
  `defaultphone` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contacts`
--

CREATE TABLE `contacts` (
  `id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contactsocialmedia`
--

CREATE TABLE `contactsocialmedia` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `contact_id` int(10) UNSIGNED NOT NULL,
  `socialmedia_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `contacttypes`
--

CREATE TABLE `contacttypes` (
  `id` tinyint(4) UNSIGNED NOT NULL,
  `label_name` varchar(50) DEFAULT NULL,
  `position` tinyint(3) UNSIGNED NOT NULL DEFAULT 255,
  `vtype` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `cronjobs`
--

CREATE TABLE `cronjobs` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `script` varchar(255) NOT NULL,
  `schedule` varchar(255) NOT NULL,
  `protected` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Stand-in structure for view `customers`
-- (See below for the actual view)
--
CREATE TABLE `customers` (
`id` smallint(5) unsigned
,`name` varchar(50)
,`country_id` char(2)
,`approved` tinyint(1) unsigned
);

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

--
-- Stand-in structure for view `dmcs`
-- (See below for the actual view)
--
CREATE TABLE `dmcs` (
`id` tinyint(3) unsigned
,`name` varchar(45)
,`dmsdbhost` varchar(255)
,`dmsdbname` varchar(64)
,`dmsdbuser` varchar(80)
,`dmsdbpass` varchar(255)
,`memdbhost` varchar(255)
,`memdbname` varchar(64)
,`memdbuser` varchar(80)
,`memdbpass` varchar(255)
,`enabled` tinyint(1) unsigned
);

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

--
-- Table structure for table `labeldetails`
--

CREATE TABLE `labeldetails` (
  `label_id` varchar(50) NOT NULL,
  `language_id` varchar(3) NOT NULL,
  `description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `labels`
--

CREATE TABLE `labels` (
  `id` varchar(50) NOT NULL,
  `name` varchar(50) GENERATED ALWAYS AS (`id`) VIRTUAL
) 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,
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `dmslanguage_id` tinyint(4) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `locales`
--

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

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

--
-- Table structure for table `mailaccounts`
--

CREATE TABLE `mailaccounts` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `protocol` varchar(8) NOT NULL DEFAULT 'smtp',
  `smtpauth` tinyint(1) NOT NULL DEFAULT 1,
  `port` smallint(5) UNSIGNED NOT NULL,
  `smtpsecure` varchar(4) NOT NULL DEFAULT 'tls',
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `host` varchar(255) NOT NULL,
  `debug` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `protected` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 1,
  `replyto` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mailaddresses`
--

CREATE TABLE `mailaddresses` (
  `id` int(10) UNSIGNED NOT NULL,
  `mailqueue_id` int(10) UNSIGNED NOT NULL,
  `mailaddresstype_id` tinyint(3) UNSIGNED NOT NULL,
  `address` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mailaddresstypes`
--

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

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

--
-- Table structure for table `mailattachments`
--

CREATE TABLE `mailattachments` (
  `id` int(10) UNSIGNED NOT NULL,
  `mailqueue_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mailqueue`
--

CREATE TABLE `mailqueue` (
  `id` int(10) UNSIGNED NOT NULL,
  `fromname` varchar(255) DEFAULT NULL,
  `subject` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `altbody` text NOT NULL,
  `mailaccount_id` smallint(5) UNSIGNED NOT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `sent` timestamp NULL DEFAULT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `message` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mailtemplates`
--

CREATE TABLE `mailtemplates` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `subject_label` varchar(50) NOT NULL,
  `body` text NOT NULL,
  `altbody` text NOT NULL,
  `mailaccount_id` smallint(5) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mailtemplatevariables`
--

CREATE TABLE `mailtemplatevariables` (
  `mailtemplate_id` smallint(5) UNSIGNED NOT NULL,
  `variable` varchar(20) NOT NULL,
  `label_name` varchar(50) NOT NULL,
  `position` tinyint(3) UNSIGNED NOT NULL DEFAULT 255
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `man__manuals`
--

CREATE TABLE `man__manuals` (
  `id` int(10) UNSIGNED NOT NULL,
  `customer_id` smallint(5) UNSIGNED NOT NULL,
  `productlist_id` int(10) UNSIGNED NOT NULL,
  `filename` varchar(255) NOT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `notificationemails`
--

CREATE TABLE `notificationemails` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `email` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `not__notifications`
--

CREATE TABLE `not__notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title_label` varchar(50) NOT NULL,
  `message_label` varchar(50) NOT NULL,
  `link_label` varchar(50) DEFAULT NULL,
  `linkurl` text DEFAULT NULL,
  `icon` varchar(20) DEFAULT NULL,
  `type` enum('primary','secondary','success','danger','warning','info','light','dark','link') DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `delivered` timestamp NULL DEFAULT NULL,
  `viewed` timestamp NULL DEFAULT NULL,
  `deleted` timestamp NULL DEFAULT NULL,
  `user_id` smallint(5) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `passwordresets`
--

CREATE TABLE `passwordresets` (
  `user_id` smallint(5) UNSIGNED NOT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `attempts` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `key` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `productlistdetails`
--

CREATE TABLE `productlistdetails` (
  `productlist_id` int(11) NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `productlists`
--

CREATE TABLE `productlists` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `customer_id` smallint(6) DEFAULT NULL,
  `country_id` char(3) NOT NULL,
  `year` smallint(6) DEFAULT NULL,
  `pricefilter` tinyint(4) NOT NULL,
  `partner_id` tinyint(4) 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 `routecategories`
--

CREATE TABLE `routecategories` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL DEFAULT '''''',
  `enabled` tinyint(3) UNSIGNED NOT NULL DEFAULT 1,
  `lpos` smallint(5) UNSIGNED NOT NULL,
  `rpos` smallint(5) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `routes`
--

CREATE TABLE `routes` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `label_name` varchar(50) DEFAULT NULL,
  `type` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `icon` varchar(40) DEFAULT NULL,
  `position` tinyint(3) UNSIGNED DEFAULT NULL,
  `url` varchar(2047) DEFAULT NULL,
  `file` varchar(2047) NOT NULL,
  `method` varchar(6) NOT NULL COMMENT 'get, post, put, patch, delete or any',
  `ispublic` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `isalluser` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `routecategory_id` smallint(5) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `route_accesses`
--

CREATE TABLE `route_accesses` (
  `route_id` smallint(5) UNSIGNED NOT NULL,
  `access_id` smallint(5) UNSIGNED NOT NULL,
  `param` varchar(10) DEFAULT NULL,
  `required` tinyint(1) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `route_nav`
--

CREATE TABLE `route_nav` (
  `parent_route_id` smallint(5) UNSIGNED NOT NULL,
  `child_route_id` smallint(5) UNSIGNED NOT NULL,
  `position` smallint(5) UNSIGNED NOT NULL,
  `enabled` tinyint(1) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sea__statuses`
--

CREATE TABLE `sea__statuses` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `label_name` varchar(50) NOT NULL,
  `label_description` varchar(50) NOT NULL,
  `color` char(6) NOT NULL DEFAULT 'FFFFFF'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sessiondata`
--

CREATE TABLE `sessiondata` (
  `session_id` varchar(32) NOT NULL DEFAULT '',
  `hash` varchar(32) NOT NULL DEFAULT '',
  `session_data` blob NOT NULL,
  `session_expire` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `key` varchar(20) NOT NULL,
  `value` varchar(255) NOT NULL,
  `type` char(1) NOT NULL COMMENT 'B=Bool,C=Color,D=Date,P=Password,T=Text,U=Upload'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `socialmedia`
--

CREATE TABLE `socialmedia` (
  `id` int(10) UNSIGNED NOT NULL,
  `label_name` varchar(50) DEFAULT NULL,
  `icon` varchar(40) DEFAULT NULL,
  `vcat` varchar(20) NOT NULL,
  `vtype` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sys__changelogs`
--

CREATE TABLE `sys__changelogs` (
  `id` int(11) NOT NULL,
  `logtype_id` int(11) DEFAULT NULL,
  `table_name` varchar(100) DEFAULT NULL,
  `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'ID del usuario que realiza la accion',
  `method` varchar(20) NOT NULL COMMENT 'POST, PUT, DELETE, GET',
  `url` varchar(255) NOT NULL COMMENT 'Ruta ejecutada',
  `action_code` varchar(10) DEFAULT NULL COMMENT 'C, U, D (si aplica)',
  `tableh` varchar(255) DEFAULT NULL,
  `payload` text DEFAULT NULL COMMENT 'Todos los datos enviados en JSON',
  `created_at` datetime NOT NULL COMMENT 'Fecha de la operacion'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sys__logtypes`
--

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

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

--
-- Table structure for table `sys__logtype_tables`
--

CREATE TABLE `sys__logtype_tables` (
  `logtype_id` int(11) NOT NULL,
  `table` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `urlparameters`
--

CREATE TABLE `urlparameters` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `parameter` varchar(10) NOT NULL,
  `url` varchar(255) NOT NULL,
  `ispublic` tinyint(1) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `users` (
  `id` smallint(5) UNSIGNED NOT NULL,
  `email` varchar(50) NOT NULL,
  `first` varchar(50) NOT NULL,
  `last` varchar(50) NOT NULL,
  `pass` varchar(255) DEFAULT NULL,
  `dark` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  `enabled` tinyint(1) NOT NULL DEFAULT 0,
  `uuid` varchar(36) DEFAULT NULL,
  `remember_token` varchar(64) DEFAULT NULL,
  `locale_id` varchar(15) DEFAULT 'en_US',
  `access` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `lastused` timestamp NULL DEFAULT NULL,
  `dmc_id` tinyint(3) UNSIGNED DEFAULT NULL,
  `customer_id` int(10) UNSIGNED NOT NULL,
  `tmp_oldid` smallint(5) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `Xdmcs`
--

CREATE TABLE `Xdmcs` (
  `id` tinyint(3) UNSIGNED NOT NULL,
  `name` varchar(45) NOT NULL,
  `enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure for view `customers`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`latincon`@`localhost` SQL SECURITY DEFINER VIEW `customers`  AS SELECT `latincon_api_d`.`cus__customers`.`id` AS `id`, `latincon_api_d`.`cus__customers`.`name` AS `name`, `latincon_api_d`.`cus__customers`.`country_id` AS `country_id`, `latincon_api_d`.`cus__customers`.`approved` AS `approved` FROM `latincon_api_d`.`cus__customers` ;

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

--
-- Structure for view `dmcs`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`latincon`@`localhost` SQL SECURITY DEFINER VIEW `dmcs`  AS SELECT `latincon_api_d`.`dmcs`.`id` AS `id`, `latincon_api_d`.`dmcs`.`name` AS `name`, `latincon_api_d`.`dmcs`.`dmsdbhost` AS `dmsdbhost`, `latincon_api_d`.`dmcs`.`dmsdbname` AS `dmsdbname`, `latincon_api_d`.`dmcs`.`dmsdbuser` AS `dmsdbuser`, `latincon_api_d`.`dmcs`.`dmsdbpass` AS `dmsdbpass`, `latincon_api_d`.`dmcs`.`memdbhost` AS `memdbhost`, `latincon_api_d`.`dmcs`.`memdbname` AS `memdbname`, `latincon_api_d`.`dmcs`.`memdbuser` AS `memdbuser`, `latincon_api_d`.`dmcs`.`memdbpass` AS `memdbpass`, `latincon_api_d`.`dmcs`.`enabled` AS `enabled` FROM `latincon_api_d`.`dmcs` ;

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `contactaddresses`
--
ALTER TABLE `contactaddresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contact_id` (`contact_id`),
  ADD KEY `contacttype_id` (`contacttype_id`),
  ADD KEY `country_id` (`countries_id`);

--
-- Indexes for table `contactcompanies`
--
ALTER TABLE `contactcompanies`
  ADD PRIMARY KEY (`contact_id`);

--
-- Indexes for table `contactemails`
--
ALTER TABLE `contactemails`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contact_id` (`contact_id`),
  ADD KEY `contacttype_id` (`contacttype_id`),
  ADD KEY `emailaddress` (`emailaddress`);

--
-- Indexes for table `contactpersons`
--
ALTER TABLE `contactpersons`
  ADD PRIMARY KEY (`contact_id`);

--
-- Indexes for table `contactphones`
--
ALTER TABLE `contactphones`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contact_id` (`contact_id`),
  ADD KEY `contacttype_id` (`contacttype_id`);

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

--
-- Indexes for table `contactsocialmedia`
--
ALTER TABLE `contactsocialmedia`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_socialmedia_contacts1_idx` (`contact_id`),
  ADD KEY `fk_socialmedia_socialmedias1_idx` (`socialmedia_id`);

--
-- Indexes for table `contacttypes`
--
ALTER TABLE `contacttypes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_contracttypes_label1_idx` (`label_name`);

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

--
-- Indexes for table `labeldetails`
--
ALTER TABLE `labeldetails`
  ADD PRIMARY KEY (`label_id`,`language_id`),
  ADD KEY `language_id` (`language_id`);

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

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

--
-- Indexes for table `locales`
--
ALTER TABLE `locales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `language_id` (`language_id`);

--
-- Indexes for table `mailaccounts`
--
ALTER TABLE `mailaccounts`
  ADD UNIQUE KEY `id` (`id`);

--
-- Indexes for table `mailaddresses`
--
ALTER TABLE `mailaddresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mailer_id` (`mailqueue_id`),
  ADD KEY `mailtype_id` (`mailaddresstype_id`);

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

--
-- Indexes for table `mailattachments`
--
ALTER TABLE `mailattachments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mailqueue_id` (`mailqueue_id`);

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

--
-- Indexes for table `mailtemplates`
--
ALTER TABLE `mailtemplates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mailaccount_id` (`mailaccount_id`);

--
-- Indexes for table `mailtemplatevariables`
--
ALTER TABLE `mailtemplatevariables`
  ADD PRIMARY KEY (`mailtemplate_id`,`variable`),
  ADD KEY `mailtemplate_id` (`mailtemplate_id`) USING BTREE;

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

--
-- Indexes for table `not__notifications`
--
ALTER TABLE `not__notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `passwordresets`
--
ALTER TABLE `passwordresets`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `uuid` (`key`);

--
-- Indexes for table `productlistdetails`
--
ALTER TABLE `productlistdetails`
  ADD PRIMARY KEY (`productlist_id`,`product_id`),
  ADD KEY `product_id` (`product_id`);

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

--
-- 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 `routecategories`
--
ALTER TABLE `routecategories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lpos` (`lpos`),
  ADD KEY `rpos` (`rpos`);

--
-- Indexes for table `routes`
--
ALTER TABLE `routes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `label_name` (`label_name`),
  ADD KEY `menucategory_id` (`routecategory_id`);

--
-- Indexes for table `route_accesses`
--
ALTER TABLE `route_accesses`
  ADD PRIMARY KEY (`route_id`,`access_id`),
  ADD KEY `access_id` (`access_id`);

--
-- Indexes for table `route_nav`
--
ALTER TABLE `route_nav`
  ADD PRIMARY KEY (`parent_route_id`,`child_route_id`),
  ADD KEY `child_route_id` (`child_route_id`);

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

--
-- Indexes for table `sessiondata`
--
ALTER TABLE `sessiondata`
  ADD PRIMARY KEY (`session_id`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`key`);

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

--
-- Indexes for table `sys__changelogs`
--
ALTER TABLE `sys__changelogs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_userid` (`user_id`),
  ADD KEY `idx_created_at` (`created_at`);

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

--
-- Indexes for table `sys__logtype_tables`
--
ALTER TABLE `sys__logtype_tables`
  ADD PRIMARY KEY (`logtype_id`,`table`);

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

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email_UNIQUE` (`email`),
  ADD KEY `language_id` (`locale_id`),
  ADD KEY `dmc_id` (`dmc_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `contactaddresses`
--
ALTER TABLE `contactaddresses`
  ADD CONSTRAINT `contactaddresses_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `contactaddresses_ibfk_2` FOREIGN KEY (`contacttype_id`) REFERENCES `contacttypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `contactaddresses_ibfk_3` FOREIGN KEY (`countries_id`) REFERENCES `ref__countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `contactcompanies`
--
ALTER TABLE `contactcompanies`
  ADD CONSTRAINT `fk_contactcompanies_contacts1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `contactemails`
--
ALTER TABLE `contactemails`
  ADD CONSTRAINT `contactemails_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `contactemails_ibfk_2` FOREIGN KEY (`contacttype_id`) REFERENCES `contacttypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `contactpersons`
--
ALTER TABLE `contactpersons`
  ADD CONSTRAINT `fk_contactpersons_contacts1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `contactphones`
--
ALTER TABLE `contactphones`
  ADD CONSTRAINT `contactphones_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `contactphones_ibfk_2` FOREIGN KEY (`contacttype_id`) REFERENCES `contacttypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `contactsocialmedia`
--
ALTER TABLE `contactsocialmedia`
  ADD CONSTRAINT `fk_socialmedia_contacts1` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_socialmedia_socialmedia1` FOREIGN KEY (`socialmedia_id`) REFERENCES `socialmedia` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `labeldetails`
--
ALTER TABLE `labeldetails`
  ADD CONSTRAINT `labeldetails_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `labeldetails_ibfk_3` FOREIGN KEY (`label_id`) REFERENCES `labels` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `locales`
--
ALTER TABLE `locales`
  ADD CONSTRAINT `locales_ibfk_1` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `mailaddresses`
--
ALTER TABLE `mailaddresses`
  ADD CONSTRAINT `mailaddresses_ibfk_2` FOREIGN KEY (`mailaddresstype_id`) REFERENCES `mailaddresstypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mailaddresses_ibfk_3` FOREIGN KEY (`mailqueue_id`) REFERENCES `mailqueue` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `mailattachments`
--
ALTER TABLE `mailattachments`
  ADD CONSTRAINT `mailattachments_ibfk_1` FOREIGN KEY (`mailqueue_id`) REFERENCES `mailqueue` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `mailqueue`
--
ALTER TABLE `mailqueue`
  ADD CONSTRAINT `mailqueue_ibfk_1` FOREIGN KEY (`mailaccount_id`) REFERENCES `mailaccounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `mailtemplates`
--
ALTER TABLE `mailtemplates`
  ADD CONSTRAINT `mailtemplates_ibfk_1` FOREIGN KEY (`mailaccount_id`) REFERENCES `mailaccounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Constraints for table `mailtemplatevariables`
--
ALTER TABLE `mailtemplatevariables`
  ADD CONSTRAINT `mailtemplatevariables_ibfk_1` FOREIGN KEY (`mailtemplate_id`) REFERENCES `mailtemplates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `not__notifications`
--
ALTER TABLE `not__notifications`
  ADD CONSTRAINT `not__notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `passwordresets`
--
ALTER TABLE `passwordresets`
  ADD CONSTRAINT `passwordresets_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `productlistdetails`
--
ALTER TABLE `productlistdetails`
  ADD CONSTRAINT `productlistdetails_ibfk_1` FOREIGN KEY (`productlist_id`) REFERENCES `productlists` (`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 `routes`
--
ALTER TABLE `routes`
  ADD CONSTRAINT `routes_ibfk_1` FOREIGN KEY (`routecategory_id`) REFERENCES `routecategories` (`id`) ON UPDATE CASCADE;

--
-- Constraints for table `route_accesses`
--
ALTER TABLE `route_accesses`
  ADD CONSTRAINT `route_accesses_ibfk_1` FOREIGN KEY (`route_id`) REFERENCES `routes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `route_accesses_ibfk_2` FOREIGN KEY (`access_id`) REFERENCES `accesses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `route_nav`
--
ALTER TABLE `route_nav`
  ADD CONSTRAINT `route_nav_ibfk_1` FOREIGN KEY (`parent_route_id`) REFERENCES `routes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `route_nav_ibfk_2` FOREIGN KEY (`child_route_id`) REFERENCES `routes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `sys__logtype_tables`
--
ALTER TABLE `sys__logtype_tables`
  ADD CONSTRAINT `fk_logtype` FOREIGN KEY (`logtype_id`) REFERENCES `sys__logtypes` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`locale_id`) REFERENCES `locales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`dmc_id`) REFERENCES `Xdmcs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
COMMIT;

