-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 18-04-2022 a las 17:22:54
-- Versión del servidor: 8.0.28-0ubuntu0.20.04.3
-- Versión de PHP: 7.4.3

START TRANSACTION;



--
-- Base de datos: `core_customers`
--

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

--
-- Estructura de tabla para la tabla `core_customers_catalog_items`
--

CREATE TABLE `core_customers_catalog_items` (
  `id` int NOT NULL,
  `users_sid` varchar(50) NOT NULL COMMENT 'global_users',
  `global_branch_office_id` varchar(50) DEFAULT NULL COMMENT 'global_branch_office',
  `value` int NOT NULL,
  `label` varchar(250) NOT NULL,
  `lang` varchar(5) NOT NULL,
  `catalog_code` varchar(50) NOT NULL,
  `catalog_code_dep` varchar(50) NOT NULL,
  `catalog_id_dep` int NOT NULL,
  `description` varchar(512) NOT NULL,
  `svg_image` varchar(150) DEFAULT NULL,
  `status` varchar(2) NOT NULL DEFAULT 'A',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='mysql://root:123456789@localhost:3306/core/global_catalog_items';

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

--
-- Estructura de tabla para la tabla `core_customers_countries`
--

CREATE TABLE `core_customers_countries` (
  `id` mediumint UNSIGNED NOT NULL,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `iso3` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `iso2` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phonecode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `capital` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `currency` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `native` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emoji` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emojiU` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `flag` tinyint(1) NOT NULL DEFAULT '1',
  `wikiDataId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Rapid API GeoDB Cities'
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='mysql://root:123456789@localhost:3306/core/global_countries';

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

--
-- Estructura de tabla para la tabla `core_customers_currency`
--

CREATE TABLE `core_customers_currency` (
  `id` int NOT NULL,
  `users_sid` varchar(50) NOT NULL,
  `currency` varchar(50) NOT NULL,
  `code` varchar(15) NOT NULL,
  `usd_dollar` enum('Y','N') NOT NULL DEFAULT 'N',
  `global_countries_id` int NOT NULL COMMENT 'global_countries',
  `status` enum('A','X') NOT NULL DEFAULT 'A',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT NULL
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='mysql://root:123456789@localhost:3306/core/global_currency';

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

--
-- Estructura de tabla para la tabla `core_customers_person`
--

CREATE TABLE `core_customers_person` (
  `id` int NOT NULL,
  `users_sid` varchar(50) NOT NULL,
  `first_name` varchar(50) NOT NULL COMMENT 'The first and middle name',
  `last_name` varchar(75) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'Last name',
  `phone_number` varchar(200) DEFAULT NULL,
  `intern` varchar(75) DEFAULT NULL COMMENT '	Intern number',
  `cargo_id` int NOT NULL COMMENT 'Related to catalogs',
  `area_id` int NOT NULL COMMENT 'Related to catalogs',
  `country_id` int DEFAULT NULL COMMENT 'Related to country table',
  `status` enum('A','X') NOT NULL DEFAULT 'A',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='mysql://root:123456789@localhost:3306/core/global_person';

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

--
-- Estructura de tabla para la tabla `core_customers_users`
--

CREATE TABLE `core_customers_users` (
  `id` bigint NOT NULL,
  `sid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'uuid()',
  `person_id` int NOT NULL COMMENT 'related to person table',
  `global_branch_office_id` varchar(50) DEFAULT NULL COMMENT 'global_branch_office',
  `profile_picture` varchar(50) DEFAULT NULL COMMENT 'The complete filename',
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'email',
  `password` tinytext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'The password',
  `remember_token` text COMMENT 'The Token',
  `ttl` int NOT NULL DEFAULT '172800' COMMENT 'The time logged in',
  `wrong_login_attempt` tinyint NOT NULL DEFAULT '0' COMMENT 'Times wrong',
  `date_wrong_login_attempt` date DEFAULT NULL COMMENT 'Date when wrong',
  `client_ip` varchar(50) DEFAULT NULL COMMENT 'the clients IP',
  `status` enum('A','X','B') NOT NULL,
  `created_at` timestamp NOT NULL COMMENT 'When the user were created',
  `updated_at` timestamp NULL DEFAULT NULL COMMENT 'When the user were updated'
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb3 CONNECTION='mysql://root:123456789@localhost:3306/core/global_users';

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

--
-- Estructura de tabla para la tabla `customers_catalog_items`
--

CREATE TABLE `customers_catalog_items` (
  `id` int NOT NULL,
  `catalogs_id` int NOT NULL,
  `users_sid` varchar(50) NOT NULL,
  `global_branch_office_id` varchar(50) NOT NULL COMMENT 'related to branch office',
  `value` int NOT NULL,
  `label` varchar(250) NOT NULL,
  `lang` varchar(5) NOT NULL,
  `catalog_code` varchar(50) NOT NULL,
  `catalog_code_dep` varchar(50) NOT NULL,
  `catalog_id_dep` int NOT NULL,
  `description` varchar(512) NOT NULL,
  `svg_image` varchar(150) DEFAULT NULL,
  `status` varchar(2) NOT NULL DEFAULT 'A',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Volcado de datos para la tabla `customers_catalog_items`
--

INSERT INTO `customers_catalog_items` (`id`, `catalogs_id`, `users_sid`, `global_branch_office_id`, `value`, `label`, `lang`, `catalog_code`, `catalog_code_dep`, `catalog_id_dep`, `description`, `svg_image`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 1, 'CLIENTE', 'es', 'TIPOCLIENTE', '0', 0, 'CLIENTE', NULL, 'A', '2022-03-08 19:59:55', '2022-03-08 19:59:55'),
(2, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 2, 'PROSPECTO', 'es', 'TIPOCLIENTE', '0', 0, 'PROSPECTO', NULL, 'A', '2022-03-08 20:00:02', '2022-03-08 20:00:02'),
(3, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 1, 'CI - CEDULA DE IDENTIDAD', 'es', 'TIPODOCUMENTO', '0', 0, 'CI - CEDULA DE IDENTIDAD', NULL, 'A', '2022-03-08 22:47:53', '2022-03-08 22:47:53'),
(4, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 2, 'CEX - CEDULA DE IDENTIDAD DE EXTRANJERO', 'es', 'TIPODOCUMENTO', '0', 0, 'CEX - CEDULA DE IDENTIDAD DE EXTRANJERO', NULL, 'A', '2022-03-08 22:48:01', '2022-03-08 22:48:01'),
(5, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 3, 'PAS - PASAPORTE', 'es', 'TIPODOCUMENTO', '0', 0, 'PAS - PASAPORTE', NULL, 'A', '2022-03-08 22:48:08', '2022-03-08 22:48:08'),
(6, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 4, 'OD - OTRO DOCUMENTO DE IDENTIDAD', 'es', 'TIPODOCUMENTO', '0', 0, 'OD - OTRO DOCUMENTO DE IDENTIDAD', NULL, 'A', '2022-03-08 22:48:15', '2022-03-08 22:48:15'),
(7, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 5, 'NIT - NÚMERO DE IDENTIFICACIÓN TRIBUTARIA', 'es', 'TIPODOCUMENTO', '0', 0, 'NIT - NÚMERO DE IDENTIFICACIÓN TRIBUTARIA', NULL, 'A', '2022-03-08 22:48:21', '2022-03-08 22:48:21'),
(8, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 2, 'MUJER', 'es', 'GENDER', '0', 0, 'MUJER', NULL, 'A', '2022-04-11 20:37:43', '2022-04-11 20:37:54'),
(9, 1, '69abe0de-7812-41bd-9124-6a7238aee7d1', '69abe0de-7812-41bd-9124-6a7238aee7d1', 1, 'VARON', 'es', 'GENDER', '0', 0, 'VARON', NULL, 'A', '2022-04-11 20:38:03', '2022-04-11 20:38:03');

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

--
-- Estructura de tabla para la tabla `portfolio_customers`
--

CREATE TABLE `portfolio_customers` (
  `relative` varchar(50) NOT NULL,
  `users_sid` varchar(50) NOT NULL COMMENT 'Related to users table',
  `global_branch_office_id` varchar(50) NOT NULL COMMENT 'Related to branch office on core',
  `customer_type_id` int NOT NULL COMMENT 'Related to catalogs item',
  `code` varchar(100) DEFAULT NULL,
  `first_name` varchar(75) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `middle_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'Could be null',
  `last_name` varchar(50) DEFAULT NULL COMMENT 'Could be null',
  `country_id` int NOT NULL COMMENT 'Related to country table',
  `document_type` int NOT NULL COMMENT 'Related to catalogs table = DOCTYPE',
  `document_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0',
  `gender_id` int DEFAULT NULL COMMENT 'Related to catalogs items = GENDER',
  `birthday` date DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `social_media` text,
  `phones` varchar(150) DEFAULT NULL,
  `address` varchar(512) DEFAULT NULL,
  `references` mediumtext,
  `photo` text,
  `status` varchar(2) NOT NULL DEFAULT 'A',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `customers_catalog_items`
--
ALTER TABLE `customers_catalog_items`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `portfolio_customers`
--
ALTER TABLE `portfolio_customers`
  ADD PRIMARY KEY (`relative`),
  ADD UNIQUE KEY `relative` (`relative`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `customers_catalog_items`
--
ALTER TABLE `customers_catalog_items`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
COMMIT;

