DROP TABLE IF EXISTS wcf1_attachment;
CREATE TABLE wcf1_attachment (
	attachmentID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	packageID INT(10) NOT NULL DEFAULT 0,
	containerID INT(10) NOT NULL DEFAULT 0,
	containerType VARCHAR(255) NOT NULL DEFAULT '',
	userID INT(10) NOT NULL DEFAULT 0,
	attachmentName VARCHAR(255) NOT NULL DEFAULT '',
	attachmentSize INT(10) NOT NULL DEFAULT 0,
	fileType VARCHAR(255) NOT NULL DEFAULT '',
	isBinary TINYINT(1) NOT NULL DEFAULT 0,
	isImage TINYINT(1) NOT NULL DEFAULT 0,
	width SMALLINT(5) NOT NULL DEFAULT 0,
	height SMALLINT(5) NOT NULL DEFAULT 0, 
	thumbnailType VARCHAR(255) NOT NULL DEFAULT '',
	thumbnailSize INT(10) NOT NULL DEFAULT 0,
	thumbnailWidth SMALLINT(5) NOT NULL DEFAULT 0,
	thumbnailHeight SMALLINT(5) NOT NULL DEFAULT 0,
	downloads INT(10) NOT NULL DEFAULT 0,
	lastDownloadTime INT(10) NOT NULL DEFAULT 0,
	sha1Hash VARCHAR(40) NOT NULL DEFAULT '',
	idHash VARCHAR(40) NOT NULL DEFAULT '',
	uploadTime INT(10) NOT NULL DEFAULT 0,
	embedded TINYINT(1) NOT NULL DEFAULT 0,
	showOrder SMALLINT(5) NOT NULL DEFAULT 0,
	KEY (packageID, containerID, containerType),
	KEY (packageID, idHash, containerType),
	KEY (userID, packageID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS wcf1_attachment_container_type;
CREATE TABLE wcf1_attachment_container_type (
	containerTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	packageID INT(10) NOT NULL,
	containerType VARCHAR(255) NOT NULL,
	isPrivate TINYINT(1) NOT NULL DEFAULT 0,
	url VARCHAR(255) NOT NULL DEFAULT '',
	UNIQUE KEY (packageID, containerType),
	KEY (isPrivate)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;