# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 127.0.0.1 (MySQL 5.6.19-1~exp1ubuntu2)
# Database: ford_inventario_virtual
# Generation Time: 2015-07-10 20:29:02 +0000
# ************************************************************


/*!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 utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


# Dump of table bodegas
# ------------------------------------------------------------

DROP TABLE IF EXISTS `bodegas`;

CREATE TABLE `bodegas` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_concesionario` int(10) unsigned NOT NULL,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `ubicacion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table ciudades
# ------------------------------------------------------------

DROP TABLE IF EXISTS `ciudades`;

CREATE TABLE `ciudades` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table concesionarios
# ------------------------------------------------------------

DROP TABLE IF EXISTS `concesionarios`;

CREATE TABLE `concesionarios` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `codigo` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `sucursal` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `nit` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_ciudad` smallint(5) unsigned DEFAULT NULL,
  `ubicacion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `contacto` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `telefono` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `website` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `email` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `contacto_alterno_1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `contacto_alterno_2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `contacto_alterno_3` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventario_dealer
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventario_dealer`;

CREATE TABLE `inventario_dealer` (
  `codigo` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `descripcion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cantidad` int(11) DEFAULT '0',
  `costo` double DEFAULT '0',
  `id_concesionario` int(10) unsigned NOT NULL,
  `id_bodega` int(10) unsigned NOT NULL,
  `id_inventario` int(10) unsigned NOT NULL,
  `id_upload` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventario_dealer_temp
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventario_dealer_temp`;

CREATE TABLE `inventario_dealer_temp` (
  `codigo` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `descripcion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cantidad` int(11) DEFAULT '0',
  `costo` double DEFAULT '0',
  `id_concesionario` int(10) unsigned NOT NULL,
  `id_bodega` int(10) unsigned NOT NULL,
  `id_inventario` int(10) unsigned NOT NULL,
  `id_upload` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventario_dealer_uploads
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventario_dealer_uploads`;

CREATE TABLE `inventario_dealer_uploads` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `id_concesionario` int(10) unsigned NOT NULL,
  `id_bodega` int(10) unsigned NOT NULL,
  `id_inventario` int(10) unsigned NOT NULL,
  `id_usuario` int(10) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  `status` smallint(6) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventario_maestro
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventario_maestro`;

CREATE TABLE `inventario_maestro` (
  `codigo` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_base` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_sufijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `referencia` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `descripcion_corta` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `fecha_incorporacion` date DEFAULT NULL,
  `categoria` char(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `familia` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `categoria_familia` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_linea_mayor` smallint(5) unsigned DEFAULT NULL,
  `id_merchandiser` smallint(5) unsigned DEFAULT NULL,
  `status` smallint(6) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`codigo`),
  KEY `id_linea_mayor` (`id_linea_mayor`),
  KEY `id_merchandiser` (`id_merchandiser`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventario_maestro_temp
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventario_maestro_temp`;

CREATE TABLE `inventario_maestro_temp` (
  `codigo` varchar(32) COLLATE utf8_unicode_ci DEFAULT '',
  `codigo_prefijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT '',
  `codigo_base` varchar(16) COLLATE utf8_unicode_ci DEFAULT '',
  `codigo_sufijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT '',
  `referencia` varchar(64) COLLATE utf8_unicode_ci DEFAULT '',
  `descripcion_corta` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',
  `fecha_incorporacion` date DEFAULT NULL,
  `categoria` char(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `familia` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `categoria_familia` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_linea_mayor` smallint(5) unsigned DEFAULT NULL,
  `id_merchandiser` smallint(5) unsigned DEFAULT NULL,
  `status` smallint(6) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table inventarios
# ------------------------------------------------------------

DROP TABLE IF EXISTS `inventarios`;

CREATE TABLE `inventarios` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_concesionario` int(10) unsigned NOT NULL,
  `id_bodega` int(10) unsigned NOT NULL,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table linea_mayor
# ------------------------------------------------------------

DROP TABLE IF EXISTS `linea_mayor`;

CREATE TABLE `linea_mayor` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table merchandisers
# ------------------------------------------------------------

DROP TABLE IF EXISTS `merchandisers`;

CREATE TABLE `merchandisers` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table migrations
# ------------------------------------------------------------

DROP TABLE IF EXISTS `migrations`;

CREATE TABLE `migrations` (
  `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table password_resets
# ------------------------------------------------------------

DROP TABLE IF EXISTS `password_resets`;

CREATE TABLE `password_resets` (
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  KEY `password_resets_email_index` (`email`),
  KEY `password_resets_token_index` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table productos
# ------------------------------------------------------------

DROP TABLE IF EXISTS `productos`;

CREATE TABLE `productos` (
  `codigo` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_base` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_sufijo` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `referencia` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `descripcion_corta` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `fecha_incorporacion` date DEFAULT NULL,
  `categoria` char(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_linea_mayor` smallint(5) unsigned DEFAULT NULL,
  `id_merchandiser` smallint(5) unsigned DEFAULT NULL,
  `status` smallint(6) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`codigo`),
  KEY `id_linea_mayor` (`id_linea_mayor`),
  KEY `id_merchandiser` (`id_merchandiser`),
  CONSTRAINT `productos_ibfk_1` FOREIGN KEY (`id_linea_mayor`) REFERENCES `linea_mayor` (`id`),
  CONSTRAINT `productos_ibfk_2` FOREIGN KEY (`id_merchandiser`) REFERENCES `merchandisers` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table queued_jobs
# ------------------------------------------------------------

DROP TABLE IF EXISTS `queued_jobs`;

CREATE TABLE `queued_jobs` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `arguments` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `started_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `status` smallint(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table reemplazo_piezas
# ------------------------------------------------------------

DROP TABLE IF EXISTS `reemplazo_piezas`;

CREATE TABLE `reemplazo_piezas` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `referencia_1` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo_1` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_sufijo_1` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_base_1` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `serial_1` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `referencia_2` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo_2` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_sufijo_2` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `codigo_base_2` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `serial_2` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `descripcion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `precio` double DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table reemplazo_piezas_temp
# ------------------------------------------------------------

DROP TABLE IF EXISTS `reemplazo_piezas_temp`;

CREATE TABLE `reemplazo_piezas_temp` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `referencia_1` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo_1` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `codigo_sufijo_1` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `codigo_base_1` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `serial_1` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `referencia_2` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `codigo_prefijo_2` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `codigo_sufijo_2` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `codigo_base_2` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `serial_2` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `descripcion` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `precio` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table users
# ------------------------------------------------------------

DROP TABLE IF EXISTS `users`;

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `apellido` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
  `avatar` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `telefono` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `extension` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `celular` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `rol` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_concesionario` int(10) unsigned DEFAULT NULL,
  `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` smallint(6) DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table usuarios_admin_concesionarios
# ------------------------------------------------------------

DROP TABLE IF EXISTS `usuarios_admin_concesionarios`;

CREATE TABLE `usuarios_admin_concesionarios` (
  `id_concesionario` int(10) unsigned NOT NULL,
  `id_usuario` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_concesionario`,`id_usuario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



# Dump of table usuarios_admin_inventarios
# ------------------------------------------------------------

DROP TABLE IF EXISTS `usuarios_admin_inventarios`;

CREATE TABLE `usuarios_admin_inventarios` (
  `id_usuario` int(10) unsigned DEFAULT NULL,
  `id_concesionario` int(10) unsigned DEFAULT NULL,
  `id_bodega` int(10) unsigned DEFAULT NULL,
  `id_inventario` int(10) unsigned DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;




/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!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 */;
