/*
SQLyog Ultimate v11.11 (64 bit)
MySQL - 5.5.5-10.11.18-MariaDB : Database - grupoo7_telegram
*********************************************************************
*/



CREATE DATABASE /*!32312 IF NOT EXISTS*/`grupoo7_telegram` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;

USE `grupoo7_telegram`;

/*Table structure for table `appgini_csv_import_jobs` */


CREATE TABLE `appgini_csv_import_jobs` (
  `id` varchar(40) NOT NULL,
  `memberID` varchar(100) NOT NULL,
  `config` text DEFAULT NULL,
  `insert_ts` int(11) DEFAULT NULL,
  `last_update_ts` int(11) DEFAULT NULL,
  `total` int(11) DEFAULT 99999999,
  `done` int(11) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `appgini_csv_import_jobs` */

/*Table structure for table `appgini_query_log` */


CREATE TABLE `appgini_query_log` (
  `datetime` timestamp NOT NULL DEFAULT current_timestamp(),
  `statement` longtext DEFAULT NULL,
  `duration` decimal(10,2) unsigned DEFAULT 0.00,
  `error` text DEFAULT NULL,
  `memberID` varchar(200) DEFAULT NULL,
  `uri` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `appgini_query_log` */

/*Table structure for table `appgini_saved_filters` */


CREATE TABLE `appgini_saved_filters` (
  `username` varchar(100) NOT NULL,
  `title` varchar(150) NOT NULL,
  `link` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  UNIQUE KEY `username_title` (`username`,`title`),
  KEY `username` (`username`),
  KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `appgini_saved_filters` */

/*Table structure for table `base_campo_vendedor_actual` */


CREATE TABLE `base_campo_vendedor_actual` (
  `id_base_campo_vendedor_actual` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fecha_creacion_base_campo_vendedor_actual` timestamp NULL DEFAULT NULL,
  `fecha_actualizacion_base_campo_vendedor_actual` timestamp NULL DEFAULT NULL,
  `usuario_creador_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `usuario_actualizador_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `cedula_base_campo_vendedor_actual` varchar(255) NOT NULL,
  `cliente_base_campo_vendedor_actual` varchar(255) NOT NULL,
  `anio_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `mes_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `provincia_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `dependencia_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `valor_factura_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `valor_cuota_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `abonos_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `numero_cobros_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `numero_vencidas_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `saldo_fecha_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `telefono_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `direccion_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `vendedor_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `asesor_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  `tipo_cartera_base_campo_vendedor_actual` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id_base_campo_vendedor_actual`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `base_campo_vendedor_actual` */

/*Table structure for table `base_campo_vendedor_historico` */


CREATE TABLE `base_campo_vendedor_historico` (
  `id_base_campo_vendedor_historico` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fecha_creacion_base_campo_vendedor_historico` timestamp NULL DEFAULT NULL,
  `fecha_actualizacion_base_campo_vendedor_historico` timestamp NULL DEFAULT NULL,
  `usuario_creador_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `usuario_actualizador_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `cedula_base_campo_vendedor_historico` varchar(255) NOT NULL,
  `cliente_base_campo_vendedor_historico` varchar(255) NOT NULL,
  `anio_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `mes_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `provincia_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `dependencia_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `valor_factura_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `valor_cuota_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `abonos_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `numero_cobros_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `numero_vencidas_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `saldo_fecha_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `telefono_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `direccion_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `vendedor_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `asesor_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  `tipo_cartera_base_campo_vendedor_historico` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id_base_campo_vendedor_historico`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `base_campo_vendedor_historico` */

/*Table structure for table `guias` */


CREATE TABLE `guias` (
  `id_guias` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fecha_creacion_guias` timestamp NULL DEFAULT NULL,
  `fecha_actualizacion_guias` timestamp NULL DEFAULT NULL,
  `usuario_creador_guias` varchar(255) DEFAULT NULL,
  `numero_guia` varchar(255) DEFAULT NULL,
  `vendedor` int(10) unsigned DEFAULT NULL,
  `cliente` varchar(255) DEFAULT NULL,
  `direccion_entrega` varchar(255) DEFAULT NULL,
  `estado_guia` varchar(255) DEFAULT 'Pendiente',
  `notificado_telegram` varchar(255) DEFAULT 'No',
  PRIMARY KEY (`id_guias`),
  UNIQUE KEY `numero_guia` (`numero_guia`),
  KEY `vendedor` (`vendedor`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `guias` */

insert  into `guias`(`id_guias`,`fecha_creacion_guias`,`fecha_actualizacion_guias`,`usuario_creador_guias`,`numero_guia`,`vendedor`,`cliente`,`direccion_entrega`,`estado_guia`,`notificado_telegram`) values (1,'2026-07-15 16:35:53',NULL,'admin','12312312',1,'adasdas','asdasdasd','Pendiente','No'),(2,'2026-07-15 16:45:23',NULL,'admin','89689789',1,'jgjkhjk','jhghjg','Pendiente','No'),(3,'2026-07-15 16:57:14',NULL,'admin','asdas12312312',1,'1asdasd','asdasdasdasd','Pendiente','No'),(4,'2026-07-15 16:59:40',NULL,'admin','2342423',1,'sdad','dasdasd','Pendiente','No'),(5,'2026-07-15 17:07:42',NULL,'admin','123123',1,'asdasdas','dasdasdasd','Pendiente','No'),(6,'2026-07-15 17:14:22',NULL,'admin','sdaasdas',1,'asdasdas','asdasdasd','Pendiente','No');

/*Data for the table `membership_2fa_requests` */

/*Table structure for table `membership_cache` */


CREATE TABLE `membership_cache` (
  `request` varchar(100) NOT NULL,
  `request_ts` int(11) DEFAULT NULL,
  `response` longtext DEFAULT NULL,
  PRIMARY KEY (`request`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `membership_cache` */

/*Table structure for table `membership_grouppermissions` */


CREATE TABLE `membership_grouppermissions` (
  `permissionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `groupID` int(10) unsigned DEFAULT NULL,
  `tableName` varchar(100) DEFAULT NULL,
  `allowInsert` tinyint(4) NOT NULL DEFAULT 0,
  `allowView` tinyint(4) NOT NULL DEFAULT 0,
  `allowEdit` tinyint(4) NOT NULL DEFAULT 0,
  `allowDelete` tinyint(4) NOT NULL DEFAULT 0,
  PRIMARY KEY (`permissionID`),
  UNIQUE KEY `groupID_tableName` (`groupID`,`tableName`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `membership_grouppermissions` */

insert  into `membership_grouppermissions`(`permissionID`,`groupID`,`tableName`,`allowInsert`,`allowView`,`allowEdit`,`allowDelete`) values (1,2,'base_campo_vendedor_actual',1,3,3,3),(2,2,'base_campo_vendedor_historico',1,3,3,3),(3,2,'vendedores_telegram',1,3,3,3),(4,2,'guias',1,3,3,3);

/*Table structure for table `membership_groups` */


CREATE TABLE `membership_groups` (
  `groupID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `allowSignup` tinyint(4) DEFAULT NULL,
  `needsApproval` tinyint(4) DEFAULT NULL,
  `allowCSVImport` tinyint(4) NOT NULL DEFAULT 0,
  `allow_2fa` tinyint(4) NOT NULL DEFAULT 0,
  PRIMARY KEY (`groupID`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `membership_groups` */

insert  into `membership_groups`(`groupID`,`name`,`description`,`allowSignup`,`needsApproval`,`allowCSVImport`,`allow_2fa`) values (1,'anonymous','Anonymous group created automatically on 2026-07-15',0,0,0,0),(2,'Admins','Admin group created automatically on 2026-07-15',0,1,0,0);

/*Table structure for table `membership_userpermissions` */


CREATE TABLE `membership_userpermissions` (
  `permissionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `memberID` varchar(100) NOT NULL,
  `tableName` varchar(100) DEFAULT NULL,
  `allowInsert` tinyint(4) NOT NULL DEFAULT 0,
  `allowView` tinyint(4) NOT NULL DEFAULT 0,
  `allowEdit` tinyint(4) NOT NULL DEFAULT 0,
  `allowDelete` tinyint(4) NOT NULL DEFAULT 0,
  PRIMARY KEY (`permissionID`),
  UNIQUE KEY `memberID_tableName` (`memberID`,`tableName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `membership_userpermissions` */

/*Table structure for table `membership_userrecords` */


CREATE TABLE `membership_userrecords` (
  `recID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tableName` varchar(100) DEFAULT NULL,
  `pkValue` varchar(255) DEFAULT NULL,
  `memberID` varchar(100) DEFAULT NULL,
  `dateAdded` bigint(20) unsigned DEFAULT NULL,
  `dateUpdated` bigint(20) unsigned DEFAULT NULL,
  `groupID` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`recID`),
  UNIQUE KEY `tableName_pkValue` (`tableName`,`pkValue`(100)),
  KEY `pkValue` (`pkValue`),
  KEY `tableName` (`tableName`),
  KEY `memberID` (`memberID`),
  KEY `groupID` (`groupID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `membership_userrecords` */

insert  into `membership_userrecords`(`recID`,`tableName`,`pkValue`,`memberID`,`dateAdded`,`dateUpdated`,`groupID`) values (1,'vendedores_telegram','1','admin',1784151131,1784153636,2),(2,'guias','1','admin',1784151353,1784151353,2),(3,'guias','2','admin',1784151923,1784151923,2),(4,'guias','3','admin',1784152634,1784152634,2),(5,'guias','4','admin',1784152780,1784152780,2),(6,'guias','5','admin',1784153262,1784153262,2),(7,'guias','6','admin',1784153662,1784153662,2);

/*Data for the table `membership_usersessions` */

/*Table structure for table `vendedores_telegram` */


CREATE TABLE `vendedores_telegram` (
  `id_vendedores_telegram` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fecha_creacion_vendedores_telegram` timestamp NULL DEFAULT NULL,
  `fecha_actualizacion_vendedores_telegram` timestamp NULL DEFAULT NULL,
  `nombre_vendedor` varchar(255) DEFAULT NULL,
  `codigo_vendedor` varchar(255) DEFAULT NULL,
  `chat_id_telegram` varchar(255) DEFAULT NULL,
  `username_telegram` varchar(255) DEFAULT NULL,
  `estado_vendedor_telegram` varchar(255) DEFAULT 'Activo',
  PRIMARY KEY (`id_vendedores_telegram`),
  UNIQUE KEY `codigo_vendedor` (`codigo_vendedor`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

/*Data for the table `vendedores_telegram` */

insert  into `vendedores_telegram`(`id_vendedores_telegram`,`fecha_creacion_vendedores_telegram`,`fecha_actualizacion_vendedores_telegram`,`nombre_vendedor`,`codigo_vendedor`,`chat_id_telegram`,`username_telegram`,`estado_vendedor_telegram`) values (1,'2026-07-15 16:32:11','2026-07-15 17:13:56','FRANCISCO CORAL','GFCORAL',NULL,NULL,'Activo');

