START TRANSACTION;

  DROP TABLE IF EXISTS `clients`;
  CREATE TABLE IF NOT EXISTS `clients` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `username` VARCHAR(255) NOT NULL,
    `password` BLOB NOT NULL,
    `email` VARCHAR(255) NOT NULL,
    `active` ENUM('T','F') NOT NULL DEFAULT 'F',
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB;

  DROP TABLE IF EXISTS `clients_urls`;
  CREATE TABLE IF NOT EXISTS `clients_urls` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `client_id` INT UNSIGNED NOT NULL,
    `code` TEXT NOT NULL,
    `attempts` INT UNSIGNED NOT NULL DEFAULT 0,
    `expired` ENUM('T','F') NOT NULL DEFAULT 'F',
    `active` ENUM('T','F') NOT NULL DEFAULT 'F',
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
  ) ENGINE = InnoDB;

  
  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblUsername', 'backend', 'Label / Username', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Username', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblPassword', 'backend', 'Label / Password', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Password', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblEmail', 'backend', 'Label / Email', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Email', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_titles_ARRAY_AC03', 'arrays', 'error_titles_ARRAY_AC03', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Client added!', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_bodies_ARRAY_AC03', 'arrays', 'error_bodies_ARRAY_AC03', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'All the changes made to this client have been saved.', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_titles_ARRAY_AC01', 'arrays', 'error_titles_ARRAY_AC01', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Client updated!', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_bodies_ARRAY_AC01', 'arrays', 'error_bodies_ARRAY_AC01', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'All the changes made to this client have been saved.', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'notify_arr_ARRAY_registration', 'arrays', 'notify_arr_ARRAY_registration', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Client - registration link email', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'notify_arr_ARRAY_recovery', 'arrays', 'notify_arr_ARRAY_recovery', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Client - registration recovery email', 'script');

  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, 1, 'pjCalendar', '::LOCALE::', 'client_subject_registration', '', 'data');
  
  

  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, 1, 'pjCalendar', '::LOCALE::', 'client_subject_recovery', '', 'data');
  

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblLogin', 'frontend', 'Label / Login', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Login', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblForgotPassword', 'frontend', 'Label / Forgot password', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Forgot password?', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblInvalidLogin', 'frontend', 'Label / Invalid login', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Invalid username or password', 'script');

  INSERT INTO `options` (`foreign_id`, `key`, `tab_id`, `value`, `label`, `type`, `order`, `is_visible`, `style`) VALUES
    (1, 'o_login_attempts', 1, 3, NULL, 'int', 26, 1, NULL),
    (1, 'o_link_expiration_hours', 1, 48, NULL, 'int', 27, 1, NULL);

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'opt_o_login_attempts', 'backend', 'Options / Login attempts', 'script', '2015-11-17 07:11:13');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Login attempts', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'opt_o_link_expiration_hours', 'backend', 'Options / Link expiration hours', 'script', '2015-11-17 07:11:13');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'The link will expire in', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblBackToLogin', 'frontend', 'Label / Back to login', 'script', '2015-11-17 07:11:13');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Back to login', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblForgotPasswordSuccess', 'frontend', 'Label / Forgot password success', 'script', '2015-11-17 07:11:13');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Email has been send successful.', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_titles_ARRAY_AC05', 'arrays', 'error_titles_ARRAY_AC05', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Email sent', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'error_bodies_ARRAY_AC05', 'arrays', 'error_bodies_ARRAY_AC05', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Email has been sent successful.', 'script');

  INSERT INTO `plugin_base_fields` VALUES (NULL, 'btnPaymentConfirmationEmail', 'frontend', 'Button / Send payment email', 'script', '2017-03-09 05:27:35');
  SET @id := (SELECT LAST_INSERT_ID());
  INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Send Payment Email', 'script');

  INSERT INTO `options` (`foreign_id`, `key`, `tab_id`, `value`, `label`, `type`, `order`, `is_visible`, `style`) VALUES
    (1, 'o_cancel_pending_reservations', 3, 48, NULL, 'int', 16, 1, NULL);

  

COMMIT;