DROP TABLE IF EXISTS wcf1_style;
CREATE TABLE wcf1_style (
	styleID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	packageID INT(10) NOT NULL DEFAULT 0,
	styleName VARCHAR(255) NOT NULL DEFAULT '',
	templatePackID INT(10) NOT NULL DEFAULT 0,
	isDefault TINYINT(1) NOT NULL DEFAULT 0,
	disabled TINYINT(1) NOT NULL DEFAULT 0,
	styleDescription TEXT,
	styleVersion VARCHAR(255) NOT NULL DEFAULT '',
	styleDate CHAR(10) NOT NULL DEFAULT '0000-00-00',
	image VARCHAR(255) NOT NULL DEFAULT '',
	copyright VARCHAR(255) NOT NULL DEFAULT '',
	license VARCHAR(255) NOT NULL DEFAULT '',
	authorName VARCHAR(255) NOT NULL DEFAULT '',
	authorURL VARCHAR(255) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_style_variable;
CREATE TABLE wcf1_style_variable (
	styleID INT(10) NOT NULL AUTO_INCREMENT,
	variableName VARCHAR(50) NOT NULL DEFAULT '',
	variableValue MEDIUMTEXT,
	UNIQUE KEY (styleID, variableName)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_style_variable_to_attribute;
CREATE TABLE wcf1_style_variable_to_attribute (
	packageID INT(10) NOT NULL DEFAULT 0,
	cssSelector VARCHAR(200) NOT NULL DEFAULT '',
	attributeName VARCHAR(50) NOT NULL DEFAULT '',
	variableName VARCHAR(50) NOT NULL DEFAULT '',
	UNIQUE KEY (packageID, cssSelector, attributeName, variableName)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_style_to_package;
CREATE TABLE wcf1_style_to_package (
	styleID INT(10) NOT NULL,
	packageID INT(10) NOT NULL,
	isDefault TINYINT(1) NOT NULL DEFAULT 0,
	disabled TINYINT(1) NOT NULL DEFAULT 0,
	UNIQUE KEY (styleID, packageID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

ALTER TABLE wcf1_user ADD styleID INT(10) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_user ADD KEY (styleID);
