START TRANSACTION;

ALTER TABLE `users` DROP INDEX `email`;

ALTER TABLE `users` MODIFY `email` blob;
ALTER TABLE `users` MODIFY `name` blob;

ALTER TABLE `users` ADD COLUMN (
	`locked` enum('T','F') NOT NULL DEFAULT 'F',
	`cnt_login_fails` smallint(5) DEFAULT NULL,
	`last_login_fails` datetime DEFAULT NULL
);

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_4', 'arrays', 'login_err_ARRAY_4', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'This email does not exist in our system', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'This email does not exist in our system', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'This email does not exist in our system', 'script');

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_5', 'arrays', 'login_err_ARRAY_5', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'Wrong password', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'Wrong password', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'Wrong password', 'script');

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_6', 'arrays', 'login_err_ARRAY_6', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'Wrong password. Your account will be locked if you enter password incorrectly 3 times', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'Wrong password. Your account will be locked if you enter password incorrectly 3 times', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'Wrong password. Your account will be locked if you enter password incorrectly 3 times', 'script');

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_7', 'arrays', 'login_err_ARRAY_7', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'You have entered the wrong password 3 times so your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'You have entered the wrong password 3 times so your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'You have entered the wrong password 3 times so your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_8', 'arrays', 'login_err_ARRAY_8', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'Your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'Your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'Your account has been locked. Please contact the administrator to unlock your account (%s)', 'script');

INSERT INTO `fields` VALUES (NULL, 'login_err_ARRAY_9', 'arrays', 'login_err_ARRAY_9', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '1', 'title', 'This code does not exist in our system', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '2', 'title', 'This code does not exist in our system', 'script');
INSERT INTO `multi_lang` VALUES (NULL, @id, 'pjField', '3', 'title', 'This code does not exist in our system', 'script');


COMMIT;