+/*
+ This table was moved up here, because it must be created during the first iteration
+
+ DO *NOT* MOVE IT BACK!
+*/
+DROP TABLE IF EXISTS wcf1_package_installation_sql_log;
+CREATE TABLE wcf1_package_installation_sql_log (
+ packageID INT(10),
+ sqlTable VARCHAR(100) NOT NULL DEFAULT '',
+ sqlColumn VARCHAR(100) NOT NULL DEFAULT '',
+ sqlIndex VARCHAR(100) NOT NULL DEFAULT '',
+ UNIQUE KEY packageID (packageID, sqlTable, sqlColumn, sqlIndex)
+);
+
/* tables */
DROP TABLE IF EXISTS wcf1_acl_option;
CREATE TABLE wcf1_acl_option (
originIsSystem TINYINT(1) NOT NULL DEFAULT 0
);
+/* SQL_PARSER_OFFSET */
+
DROP TABLE IF EXISTS wcf1_core_object;
CREATE TABLE wcf1_core_object (
objectID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
isApplication TINYINT(1) NOT NULL DEFAULT 0
);
-DROP TABLE IF EXISTS wcf1_package_installation_sql_log;
-CREATE TABLE wcf1_package_installation_sql_log (
- packageID INT(10),
- sqlTable VARCHAR(100) NOT NULL DEFAULT '',
- sqlColumn VARCHAR(100) NOT NULL DEFAULT '',
- sqlIndex VARCHAR(100) NOT NULL DEFAULT '',
- UNIQUE KEY packageID (packageID, sqlTable, sqlColumn, sqlIndex)
-);
+/* The table `wcf1_package_installation_sql_log` can be found at the very top! */
/* SQL_PARSER_OFFSET */
KEY templateName (environment, templateName)
);
+/* SQL_PARSER_OFFSET */
+
DROP TABLE IF EXISTS wcf1_tracked_visit;
CREATE TABLE wcf1_tracked_visit (
objectTypeID INT(10) NOT NULL,
ALTER TABLE wcf1_box ADD FOREIGN KEY (menuID) REFERENCES wcf1_menu (menuID) ON DELETE CASCADE;
ALTER TABLE wcf1_box ADD FOREIGN KEY (linkPageID) REFERENCES wcf1_page (pageID) ON DELETE SET NULL;
+/* SQL_PARSER_OFFSET */
+
ALTER TABLE wcf1_box_content ADD FOREIGN KEY (boxID) REFERENCES wcf1_box (boxID) ON DELETE CASCADE;
ALTER TABLE wcf1_box_content ADD FOREIGN KEY (languageID) REFERENCES wcf1_language (languageID) ON DELETE CASCADE;
ALTER TABLE wcf1_box_content ADD FOREIGN KEY (imageID) REFERENCES wcf1_media (mediaID) ON DELETE SET NULL;
ALTER TABLE wcf1_language_item ADD FOREIGN KEY (languageCategoryID) REFERENCES wcf1_language_category (languageCategoryID) ON DELETE CASCADE;
ALTER TABLE wcf1_language_item ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+/* SQL_PARSER_OFFSET */
+
ALTER TABLE wcf1_media ADD FOREIGN KEY (categoryID) REFERENCES wcf1_category (categoryID) ON DELETE SET NULL;
ALTER TABLE wcf1_media ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_media ADD FOREIGN KEY (languageID) REFERENCES wcf1_language (languageID) ON DELETE SET NULL;
ALTER TABLE wcf1_search ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
+/* SQL_PARSER_OFFSET */
+
ALTER TABLE wcf1_session ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_session ADD FOREIGN KEY (spiderID) REFERENCES wcf1_spider (spiderID) ON DELETE CASCADE;
ALTER TABLE wcf1_session ADD FOREIGN KEY (pageID) REFERENCES wcf1_page (pageID) ON DELETE SET NULL;
ALTER TABLE wcf1_user ADD FOREIGN KEY (rankID) REFERENCES wcf1_user_rank (rankID) ON DELETE SET NULL;
ALTER TABLE wcf1_user ADD FOREIGN KEY (userOnlineGroupID) REFERENCES wcf1_user_group (groupID) ON DELETE SET NULL;
+/* SQL_PARSER_OFFSET */
+
ALTER TABLE wcf1_user_avatar ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_user_follow ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_like_object ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_like_object ADD FOREIGN KEY (objectUserID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
+/* SQL_PARSER_OFFSET */
+
ALTER TABLE wcf1_comment ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_comment ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;