CREATE TABLE IF NOT EXISTS `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cell` varchar(25) DEFAULT NULL,
  `invited_by` int(10) unsigned DEFAULT NULL,
  `group` enum('admin','user') NOT NULL DEFAULT 'user',
  `password` varchar(100) NOT NULL,
  `token` varchar(100) DEFAULT NULL,
  `username` varchar(50) NOT NULL COMMENT 'test',
  `phone` varchar(20) DEFAULT NULL,
  `pincode` varchar(10) NOT NULL,
  `firstname` varchar(50) NOT NULL,
  `lastname` varchar(75) DEFAULT NULL,
  `country` char(2) NOT NULL,
  `state` char(2) DEFAULT NULL,
  `timezone` float(4,2) NOT NULL DEFAULT '0.00',
  `city` varchar(75) DEFAULT NULL,
  `zip` char(5) DEFAULT NULL,
  `address` varchar(75) DEFAULT NULL,
  `active` tinyint(3) unsigned DEFAULT '0',
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

INSERT INTO `users` (`id`, `cell`, `invited_by`, `group`, `password`, `token`, `username`, `phone`, `pincode`, `firstname`, `lastname`, `country`, `state`, `timezone`, `city`, `zip`, `address`, `active`, `deleted`, `created_at`, `modified_at`) VALUES
(1, 'sacasc', NULL, 'admin', '02bc2588cef3619922adfe93632d2eed2a7ed11c4468c57329cfaba2fa707cda', 'm44unrt2pumn4jlqgp5fe9de62', 'admin@intersog.com', '23456712345', '1234567', 'Admin', '', 'by', 'XX', 3.00, 'Odessa', '43123', 'xxxxxx', 1, 0, '2015-12-06 07:43:32', NULL);

CREATE TABLE IF NOT EXISTS `branch` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `branch_name` varchar(50) NOT NULL,
  `device_id` varchar(50) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified` timestamp NULL DEFAULT NULL,
  PRIMARY KEY `id` (`id`),
  UNIQUE KEY `branch_name` (`branch_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `job` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `job_name` varchar(255) NOT NULL,
  `file` varchar(255) NOT NULL,
  `note` varchar(160) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `branch/job` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `job` int(10) unsigned NOT NULL,
  `branch` int(10) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
