--
-- Host: localhost    Database: appvendedor
-- ------------------------------------------------------


--
-- Table structure for table `app_permissions`
--

CREATE TABLE `app_permissions` (
  `code` varchar(160) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `app_permissions`
--

INSERT INTO `app_permissions` VALUES ('config.enter','Entrar a configuración'),('inventory.access','Acceder conteo'),('notify.access','Acceder notificar'),('reports.access','Acceder reportes'),('tasks.access','Acceder tareas'),('visor.discount.use','Usar descuento en visor');

--
-- Table structure for table `app_user_permissions`
--

CREATE TABLE `app_user_permissions` (
  `app_user_id` bigint(20) unsigned NOT NULL,
  `permission_code` varchar(160) NOT NULL,
  `is_enabled` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`app_user_id`,`permission_code`),
  KEY `fk_aup_perm` (`permission_code`),
  CONSTRAINT `fk_aup_perm` FOREIGN KEY (`permission_code`) REFERENCES `app_permissions` (`code`) ON DELETE CASCADE,
  CONSTRAINT `fk_aup_user` FOREIGN KEY (`app_user_id`) REFERENCES `app_users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `app_user_permissions`
--


--
-- Table structure for table `app_users`
--

CREATE TABLE `app_users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `timestore_person_id` bigint(20) unsigned NOT NULL,
  `username` varchar(80) NOT NULL,
  `full_name` varchar(160) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `is_superadmin` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `timestore_person_id` (`timestore_person_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `app_users`
--


--
-- Dumping events for database 'appvendedor'
--

--
-- Dumping routines for database 'appvendedor'
--


