DROP TABLE IF EXISTS sorting;
Create table btnsort (
	id Int UNSIGNED NOT NULL AUTO_INCREMENT,
	coreid Int UNSIGNED NOT NULL,
	linkid Int UNSIGNED NOT NULL,
	type Int UNSIGNED NOT NULL,
	sortkey Int NOT NULL,
	segmentid Int UNSIGNED NOT NULL DEFAULT 0,
	realtype Int UNSIGNED NOT NULL,
	filehash Bigint UNSIGNED NOT NULL,
 Primary Key (id)) ENGINE = MyISAM;
Create Index ind_coreid_filehash ON btnsort (coreid,filehash);
Create Index ind_coreid_type ON btnsort (coreid,type);
Create Index ind_type ON btnsort (type);
Create Index ind_linkid ON btnsort (linkid);
ALTER TABLE user ADD COLUMN lastlogin DATETIME AFTER autogen;
ALTER TABLE user ADD COLUMN lastfailedlogin DATETIME AFTER lastlogin;
ALTER TABLE user ADD COLUMN failedlogincount INTEGER DEFAULT 0 AFTER lastfailedlogin;
ALTER TABLE user ADD COLUMN hide_unit_private_resource TINYINT UNSIGNED NOT NULL DEFAULT 1 AFTER failedlogincount;
ALTER TABLE user ADD COLUMN hide_unit_admin_note TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER hide_unit_private_resource;
ALTER TABLE user ADD COLUMN successips VARCHAR(500) AFTER title;
ALTER TABLE user ADD COLUMN failedips VARCHAR(500) AFTER successips;
ALTER TABLE resource DROP COLUMN uploadsize1, DROP COLUMN upload1, DROP COLUMN url1;
ALTER TABLE resource ADD COLUMN modifierid INTEGER UNSIGNED AFTER creatorid;
ALTER TABLE resource ADD COLUMN createdate DATETIME AFTER modifierid;
ALTER TABLE resource ADD COLUMN modifydate DATETIME AFTER createdate;
ALTER TABLE survey_result MODIFY COLUMN ip VARCHAR(46) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;
ALTER TABLE config ADD COLUMN id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (id);
ALTER TABLE ci_sessions MODIFY COLUMN user_data BLOB;
UPDATE config SET system_version='1.1.0.3';