/* 
 * Copyright (C) 2018 josh.north
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Author:  josh.north
 * Created: Oct 15, 2018
 */

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!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 utf8mb4 */;

DROP TABLE IF EXISTS `lsio_idtypes`;
CREATE TABLE `lsio_idtypes` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
  `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_idtypes` (`id`, `name`) VALUES
(3, 'PASSPORT'),
(2, 'STATEID'),
(1, 'UNAVAIL');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_sites`;
CREATE TABLE `lsio_sites` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
  `name` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LOCATION CODE',
  `timezone` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'ISO TIMEZONE',
  `region` varchar(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'US, CAN, EMEA'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_sites` (`id`, `name`, `timezone`, `region`) VALUES
(1, 'NOSITE', 'UTC', 'NO'),
(2, 'Default Site', 'America/New_York', 'US');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_countries`;
CREATE TABLE `lsio_countries` (
  `id` varchar(3) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `name` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `continent` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `priority` int UNSIGNED
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_countries` (`id`, `name`, `continent`, `priority`) VALUES
('FR', 'France', 'Europe','1'),
('US', 'United States', 'North America','1'),
('CN', 'China', 'Asia','1'),
('ES', 'Spain', 'Europe','1'),
('IT', 'Italy', 'Europe','1'),
('TR', 'Turkey', 'Asia','1'),
('GB', 'United Kingdom', 'Europe','1'),
('DE', 'Germany', 'Europe','1'),
('RU', 'Russian Federation', 'Europe','1'),
('MY', 'Malaysia', 'Asia','1'),
('AF', 'Afghanistan', 'Asia','9'),
('AX', 'Åland Islands', 'Europe','9'),
('AL', 'Albania', 'Europe','9'),
('DZ', 'Algeria', 'Africa','9'),
('AS', 'American Samoa', 'Oceania','9'),
('AD', 'Andorra', 'Europe','9'),
('AO', 'Angola', 'Africa','9'),
('AI', 'Anguilla', 'North America','9'),
('AQ', 'Antarctica', 'Antarctica','9'),
('AG', 'Antigua and Barbuda', 'North America','9'),
('AR', 'Argentina', 'South America','9'),
('AM', 'Armenia', 'Asia','9'),
('AW', 'Aruba', 'North America','9'),
('AU', 'Australia', 'Oceania','9'),
('AT', 'Austria', 'Europe','9'),
('AZ', 'Azerbaijan', 'Asia','9'),
('BS', 'Bahamas', 'North America','9'),
('BH', 'Bahrain', 'Asia','9'),
('BD', 'Bangladesh', 'Asia','9'),
('BB', 'Barbados', 'North America','9'),
('BY', 'Belarus', 'Europe','9'),
('BE', 'Belgium', 'Europe','1'),
('BZ', 'Belize', 'North America','9'),
('BJ', 'Benin', 'Africa','9'),
('BM', 'Bermuda', 'North America','9'),
('BT', 'Bhutan', 'Asia','9'),
('BO', 'Bolivia', 'South America','9'),
('BA', 'Bosnia and Herzegovina', 'Europe','9'),
('BW', 'Botswana', 'Africa','9'),
('BV', 'Bouvet Island', 'Antarctica','9'),
('BR', 'Brazil', 'South America','9'),
('IO', 'British Indian Ocean Territory', 'Asia','9'),
('BN', 'Brunei Darussalam', 'Asia','9'),
('BG', 'Bulgaria', 'Europe','9'),
('BF', 'Burkina Faso', 'Africa','9'),
('BI', 'Burundi', 'Africa','9'),
('KH', 'Cambodia', 'Asia','9'),
('CM', 'Cameroon', 'Africa','9'),
('CA', 'Canada', 'North America','1'),
('CV', 'Cape Verde', 'Africa','9'),
('KY', 'Cayman Islands', 'North America','9'),
('CF', 'Central African Republic', 'Africa','9'),
('TD', 'Chad', 'Africa','9'),
('CL', 'Chile', 'South America','9'),
('CX', 'Christmas Island', 'Asia','9'),
('CC', 'Cocos (Keeling] Islands', 'Asia','9'),
('CO', 'Colombia', 'South America','9'),
('KM', 'Comoros', 'Africa','9'),
('CG', 'Congo', 'Africa','9'),
('CD', 'The Democratic Republic of The Congo', 'Africa','9'),
('CK', 'Cook Islands', 'Oceania','9'),
('CR', 'Costa Rica', 'North America','9'),
('CI', 'Cote D`ivoire', 'Africa','9'),
('HR', 'Croatia', 'Europe','9'),
('CU', 'Cuba', 'North America','9'),
('CY', 'Cyprus', 'Asia','9'),
('CZ', 'Czech Republic', 'Europe','9'),
('DK', 'Denmark', 'Europe','9'),
('DJ', 'Djibouti', 'Africa','9'),
('DM', 'Dominica', 'North America','9'),
('DO', 'Dominican Republic', 'North America','9'),
('EC', 'Ecuador', 'South America','9'),
('EG', 'Egypt', 'Africa','9'),
('SV', 'El Salvador', 'North America','9'),
('GQ', 'Equatorial Guinea', 'Africa','9'),
('ER', 'Eritrea', 'Africa','9'),
('EE', 'Estonia', 'Europe','9'),
('ET', 'Ethiopia', 'Africa','9'),
('FK', 'Falkland Islands (Malvinas]', 'South America','9'),
('FO', 'Faroe Islands', 'Europe','9'),
('FJ', 'Fiji', 'Oceania','9'),
('FI', 'Finland', 'Europe','9'),
('GF', 'French Guiana', 'South America','9'),
('PF', 'French Polynesia', 'Oceania','9'),
('TF', 'French Southern Territories', 'Antarctica','9'),
('GA', 'Gabon', 'Africa','9'),
('GM', 'Gambia', 'Africa','9'),
('GE', 'Georgia', 'Asia','9'),
('GH', 'Ghana', 'Africa','9'),
('GI', 'Gibraltar', 'Europe','9'),
('GR', 'Greece', 'Europe','9'),
('GL', 'Greenland', 'North America','9'),
('GD', 'Grenada', 'North America','9'),
('GP', 'Guadeloupe', 'North America','9'),
('GU', 'Guam', 'Oceania','9'),
('GT', 'Guatemala', 'North America','9'),
('GG', 'Guernsey', 'Europe','9'),
('GN', 'Guinea', 'Africa','9'),
('GW', 'Guinea-bissau', 'Africa','9'),
('GY', 'Guyana', 'South America','9'),
('HT', 'Haiti', 'North America','9'),
('HM', 'Heard Island and Mcdonald Islands', 'Antarctica','9'),
('VA', 'Holy See (Vatican City State]', 'Europe','9'),
('HN', 'Honduras', 'North America','9'),
('HK', 'Hong Kong', 'Asia','9'),
('HU', 'Hungary', 'Europe','9'),
('IS', 'Iceland', 'Europe','9'),
('IN', 'India', 'Asia','9'),
('ID', 'Indonesia', 'Asia','9'),
('IR', 'Iran', 'Asia','9'),
('IQ', 'Iraq', 'Asia','9'),
('IE', 'Ireland', 'Europe','1'),
('IM', 'Isle of Man', 'Europe','9'),
('IL', 'Israel', 'Asia','9'),
('JM', 'Jamaica', 'North America','9'),
('JP', 'Japan', 'Asia','9'),
('JE', 'Jersey', 'Europe','9'),
('JO', 'Jordan', 'Asia','9'),
('KZ', 'Kazakhstan', 'Asia','9'),
('KE', 'Kenya', 'Africa','9'),
('KI', 'Kiribati', 'Oceania','9'),
('KP', 'Democratic People`s Republic of Korea', 'Asia','9'),
('KR', 'Republic of Korea', 'Asia','1'),
('KW', 'Kuwait', 'Asia','9'),
('KG', 'Kyrgyzstan', 'Asia','9'),
('LA', 'Lao People`s Democratic Republic', 'Asia','9'),
('LV', 'Latvia', 'Europe','9'),
('LB', 'Lebanon', 'Asia','9'),
('LS', 'Lesotho', 'Africa','9'),
('LR', 'Liberia', 'Africa','9'),
('LY', 'Libya', 'Africa','9'),
('LI', 'Liechtenstein', 'Europe','9'),
('LT', 'Lithuania', 'Europe','9'),
('LU', 'Luxembourg', 'Europe','9'),
('MO', 'Macao', 'Asia','9'),
('MK', 'Macedonia', 'Europe','9'),
('MG', 'Madagascar', 'Africa','9'),
('MW', 'Malawi', 'Africa','9'),
('MV', 'Maldives', 'Asia','9'),
('ML', 'Mali', 'Africa','9'),
('MT', 'Malta', 'Europe','9'),
('MH', 'Marshall Islands', 'Oceania','9'),
('MQ', 'Martinique', 'North America','9'),
('MR', 'Mauritania', 'Africa','9'),
('MU', 'Mauritius', 'Africa','9'),
('YT', 'Mayotte', 'Africa','9'),
('MX', 'Mexico', 'North America','9'),
('FM', 'Micronesia', 'Oceania','9'),
('MD', 'Moldova', 'Europe','9'),
('MC', 'Monaco', 'Europe','9'),
('MN', 'Mongolia', 'Asia','9'),
('ME', 'Montenegro', 'Europe','9'),
('MS', 'Montserrat', 'North America','9'),
('MA', 'Morocco', 'Africa','9'),
('MZ', 'Mozambique', 'Africa','9'),
('MM', 'Myanmar', 'Asia','9'),
('NA', 'Namibia', 'Africa','9'),
('NR', 'Nauru', 'Oceania','9'),
('NP', 'Nepal', 'Asia','9'),
('NL', 'Netherlands', 'Europe','9'),
('AN', 'Netherlands Antilles', 'North America','9'),
('NC', 'New Caledonia', 'Oceania','9'),
('NZ', 'New Zealand', 'Oceania','9'),
('NI', 'Nicaragua', 'North America','9'),
('NE', 'Niger', 'Africa','9'),
('NG', 'Nigeria', 'Africa','9'),
('NU', 'Niue', 'Oceania','9'),
('NF', 'Norfolk Island', 'Oceania','9'),
('MP', 'Northern Mariana Islands', 'Oceania','9'),
('NO', 'Norway', 'Europe','9'),
('OM', 'Oman', 'Asia','9'),
('PK', 'Pakistan', 'Asia','9'),
('PW', 'Palau', 'Oceania','9'),
('PS', 'Palestinia', 'Asia','9'),
('PA', 'Panama', 'North America','9'),
('PG', 'Papua New Guinea', 'Oceania','9'),
('PY', 'Paraguay', 'South America','9'),
('PE', 'Peru', 'South America','9'),
('PH', 'Philippines', 'Asia','9'),
('PN', 'Pitcairn', 'Oceania','9'),
('PL', 'Poland', 'Europe','9'),
('PT', 'Portugal', 'Europe','9'),
('PR', 'Puerto Rico', 'North America','9'),
('QA', 'Qatar', 'Asia','9'),
('RE', 'Reunion', 'Africa','9'),
('RO', 'Romania', 'Europe','9'),
('RW', 'Rwanda', 'Africa','9'),
('SH', 'Saint Helena', 'Africa','9'),
('KN', 'Saint Kitts and Nevis', 'North America','9'),
('LC', 'Saint Lucia', 'North America','9'),
('PM', 'Saint Pierre and Miquelon', 'North America','9'),
('VC', 'Saint Vincent and The Grenadines', 'North America','9'),
('WS', 'Samoa', 'Oceania','9'),
('SM', 'San Marino', 'Europe','9'),
('ST', 'Sao Tome and Principe', 'Africa','9'),
('SA', 'Saudi Arabia', 'Asia','9'),
('SN', 'Senegal', 'Africa','9'),
('RS', 'Serbia', 'Europe','9'),
('SC', 'Seychelles', 'Africa','9'),
('SL', 'Sierra Leone', 'Africa','9'),
('SG', 'Singapore', 'Asia','9'),
('SK', 'Slovakia', 'Europe','9'),
('SI', 'Slovenia', 'Europe','9'),
('SB', 'Solomon Islands', 'Oceania','9'),
('SO', 'Somalia', 'Africa','9'),
('ZA', 'South Africa', 'Africa','9'),
('GS', 'South Georgia and The South Sandwich Islands', 'Antarctica','9'),
('LK', 'Sri Lanka', 'Asia','9'),
('SD', 'Sudan', 'Africa','9'),
('SR', 'Suriname', 'South America','9'),
('SJ', 'Svalbard and Jan Mayen', 'Europe','9'),
('SZ', 'Swaziland', 'Africa','9'),
('SE', 'Sweden', 'Europe','9'),
('CH', 'Switzerland', 'Europe','9'),
('SY', 'Syrian Arab Republic', 'Asia','9'),
('TW', 'Taiwan, Province of China', 'Asia','9'),
('TJ', 'Tajikistan', 'Asia','9'),
('TZ', 'Tanzania, United Republic of', 'Africa','9'),
('TH', 'Thailand', 'Asia','9'),
('TL', 'Timor-leste', 'Asia','9'),
('TG', 'Togo', 'Africa','9'),
('TK', 'Tokelau', 'Oceania','9'),
('TO', 'Tonga', 'Oceania','9'),
('TT', 'Trinidad and Tobago', 'North America','9'),
('TN', 'Tunisia', 'Africa','9'),
('TM', 'Turkmenistan', 'Asia','9'),
('TC', 'Turks and Caicos Islands', 'North America','9'),
('TV', 'Tuvalu', 'Oceania','9'),
('UG', 'Uganda', 'Africa','9'),
('UA', 'Ukraine', 'Europe','9'),
('AE', 'United Arab Emirates', 'Asia','9'),
('UM', 'United States Minor Outlying Islands', 'Oceania','9'),
('UY', 'Uruguay', 'South America','9'),
('UZ', 'Uzbekistan', 'Asia','9'),
('VU', 'Vanuatu', 'Oceania','9'),
('VE', 'Venezuela', 'South America','9'),
('VN', 'Viet Nam', 'Asia','9'),
('VG', 'Virgin Islands, British', 'North America','9'),
('VI', 'Virgin Islands, U.S.', 'North America','9'),
('WF', 'Wallis and Futuna', 'Oceania','9'),
('EH', 'Western Sahara', 'Africa','9'),
('YE', 'Yemen', 'Asia','9'),
('ZM', 'Zambia', 'Africa','9'),
('ZW', 'Zimbabwe', 'Africa', '9');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users`;
CREATE TABLE `lsio_users` (
  `id` int(10) UNSIGNED NOT NULL,
  `username` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `password` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `email` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `created` datetime NOT NULL,
  `firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `usertype` int(10) UNSIGNED NOT NULL,
  `timezone` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_users` (`id`, `username`, `password`, `email`, `created`, `firstname`, `lastname`, `usertype`, `timezone`) VALUES
(1, 'admin', '$2a$08$Y6l2CUoQgTQfQErQPEYZEuoZqDxkpAU34CoTTr7bc2oefzclUILJy', 'admin@domain.com', '2015-02-18 19:50:31', 'System', 'Administrator', 1, ''),
(2, 'KIOSK', '', '', '2018-10-19 00:00:00', '', '', 3, ''),
(3, 'Default User', '$2a$08$Y6l2CUoQgTQfQErQPEYZEuoZqDxkpAU34CoTTr7bc2oefzclUILJy', 'user1@domain.com', '2018-09-23 00:00:00', 'First', 'Last', 2, '');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_users_sites`;
CREATE TABLE `lsio_users_sites` (
  `sites_id` int(10) UNSIGNED NOT NULL COMMENT 'SITE ID',
  `users_id` int(10) UNSIGNED NOT NULL COMMENT 'USER ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='PERMISSIONS LINK TABLE';
INSERT INTO `lsio_users_sites` (`sites_id`, `users_id`) VALUES
(1, 1),
(2, 1),
(1, 2),
(2, 2),
(1, 3),
(2, 3);
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_usertypes`;
CREATE TABLE `lsio_usertypes` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
  `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_usertypes` (`id`, `name`) VALUES
(1, 'ADMIN'),
(3, 'KIOSK'),
(4, 'SADMIN'),
(2, 'USER');
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visits`;
CREATE TABLE `lsio_visits` (
  `id` int(10) UNSIGNED NOT NULL,
  `firstname` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `lastname` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `company` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `escort` varchar(50) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `intime` datetime NOT NULL,
  `outtime` datetime DEFAULT NULL,
  `signature` mediumblob,
  `escort_signature` mediumblob,
  `citizen` varchar(3) UNSIGNED DEFAULT NULL,
  `id_type` int(10) UNSIGNED DEFAULT NULL,
  `id_reference` varchar(30) UNSIGNED DEFAULT NULL,
  `initials` varchar(5) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `badge` varchar(15) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `notes` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `site_id` int(10) UNSIGNED DEFAULT NULL,
  `reason` int(10) UNSIGNED DEFAULT NULL,
  `approved` tinyint(4) DEFAULT '1' COMMENT '0 void, 1 unapproved, 2 approved',
  `carnum` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `ssanum` varchar(20) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
-- --------------------------------------------------------
DROP TABLE IF EXISTS `lsio_visittypes`;
CREATE TABLE `lsio_visittypes` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'UNIQUE ID',
  `name` char(8) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT 'LANG FILE CODE'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT INTO `lsio_visittypes` (`id`, `name`) VALUES
(2, 'ADDEQPT'),
(7, 'INSTHARD'),
(8, 'INSTSOFT'),
(9, 'MAINHARD'),
(10, 'MAINSOFT'),
(4, 'MEETING'),
(1, 'NONEAVA'),
(3, 'REMEQPT'),
(6, 'TESTING'),
(5, 'TOUR');
-- --------------------------------------------------------
ALTER TABLE `lsio_idtypes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_sites`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_countries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `users_ibfk_1` (`usertype`);
ALTER TABLE `lsio_users_sites`
  ADD UNIQUE KEY `user_site_perm` (`sites_id`,`users_id`) USING BTREE,
  ADD KEY `users_id` (`users_id`);
ALTER TABLE `lsio_usertypes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `lsio_visits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `site_id` (`site_id`),
  ADD KEY `reason` (`reason`),
  ADD KEY `id_reference` (`id_reference`),
  ADD KEY `citizen` (`citizen`),
  ADD KEY `id_type` (`id_type`);
ALTER TABLE `lsio_visittypes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id` (`id`),
  ADD UNIQUE KEY `name` (`name`);
-- --------------------------------------------------------
ALTER TABLE `lsio_idtypes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_sites`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_users`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
ALTER TABLE `lsio_usertypes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=100;
ALTER TABLE `lsio_visits`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
ALTER TABLE `lsio_visittypes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'UNIQUE ID', AUTO_INCREMENT=11;
-- --------------------------------------------------------
ALTER TABLE `lsio_users`
  ADD CONSTRAINT `lsio_users_ibfk_1` FOREIGN KEY (`usertype`) REFERENCES `lsio_usertypes` (`id`);
ALTER TABLE `lsio_users_sites`
  ADD CONSTRAINT `lsio_users_sites_ibfk_3` FOREIGN KEY (`sites_id`) REFERENCES `lsio_sites` (`id`),
  ADD CONSTRAINT `lsio_users_sites_ibfk_4` FOREIGN KEY (`users_id`) REFERENCES `lsio_users` (`id`);
ALTER TABLE `lsio_visits`
  ADD CONSTRAINT `lsio_visits_ibfk_1` FOREIGN KEY (`id_type`) REFERENCES `lsio_idtypes` (`id`),
  ADD CONSTRAINT `lsio_visits_ibfk_2` FOREIGN KEY (`reason`) REFERENCES `lsio_visittypes` (`id`),
  ADD CONSTRAINT `lsio_visits_ibfk_3` FOREIGN KEY (`site_id`) REFERENCES `lsio_sites` (`id`);
