Clipboard now support generic object types
authorAlexander Ebert <ebert@woltlab.com>
Fri, 21 Oct 2011 18:54:19 +0000 (20:54 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 21 Oct 2011 18:54:19 +0000 (20:54 +0200)
13 files changed:
XSD/clipboardItemType.xsd [deleted file]
com.woltlab.wcf/clipboardItemType.xml [deleted file]
com.woltlab.wcf/package.xml
com.woltlab.wcf/packageInstallationPlugin.xml
wcfsetup/install/files/lib/action/ClipboardAction.class.php
wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemType.class.php [deleted file]
wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeAction.class.php [deleted file]
wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeEditor.class.php [deleted file]
wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeList.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/builder/ClipboardItemTypeCacheBuilder.class.php [deleted file]
wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php
wcfsetup/install/files/lib/system/package/plugin/ClipboardItemTypePackageInstallationPlugin.class.php [deleted file]
wcfsetup/setup/db/install.sql

diff --git a/XSD/clipboardItemType.xsd b/XSD/clipboardItemType.xsd
deleted file mode 100644 (file)
index 043110f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This file is used for xml files which install, update or delete clip board item types. -->
-<xs:schema id="data" targetNamespace="http://www.woltlab.com" xmlns="http://www.woltlab.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified">
-       <!-- type element -->
-       <xs:element name="type">
-               <xs:complexType>
-                       <xs:sequence>
-                               <xs:element name="listclassname" type="xs:string" minOccurs="0" />
-                       </xs:sequence>
-                       <xs:attribute name="name" form="unqualified" type="xs:string" />
-               </xs:complexType>
-       </xs:element>
-       
-       <!-- data element -->
-       <xs:element name="data">
-               <xs:complexType>
-                       <xs:choice minOccurs="0" maxOccurs="unbounded">
-                               <xs:element ref="type" />
-                               <xs:element name="import">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element ref="type" minOccurs="0" maxOccurs="unbounded" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <xs:element name="delete">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element ref="type" minOccurs="0" maxOccurs="unbounded" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                       </xs:choice>
-               </xs:complexType>
-       </xs:element>
-</xs:schema>
\ No newline at end of file
diff --git a/com.woltlab.wcf/clipboardItemType.xml b/com.woltlab.wcf/clipboardItemType.xml
deleted file mode 100644 (file)
index 9432670..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/clipboardItemType.xsd">
-       <import>
-               <type name="com.woltlab.wcf.user">
-                       <listclassname><![CDATA[wcf\data\user\UserList]]></listclassname>
-               </type>
-       </import>
-</data>
index 3e1a71a3121d467de176bea66cda60abb32ec30f..3093d61a6a25f384b87d3028dc2bdaf87b0cf6be 100644 (file)
@@ -26,6 +26,5 @@
                <instruction type="cronjob">cronjob.xml</instruction>
                <instruction type="coreObject">coreObject.xml</instruction>
                <instruction type="clipboardAction">clipboardAction.xml</instruction>
-               <instruction type="clipboardItemType">clipboardItemType.xml</instruction>
        </instructions>
 </package>
index f3cb59da1e3132256e7b150695a0b65500a6bafc..b91601ab9ea70ba476d598e07e4f5f92ad101e10 100644 (file)
@@ -4,7 +4,6 @@
                <pip name="acpMenu">wcf\system\package\plugin\ACPMenuPackageInstallationPlugin</pip>
                <pip name="acpTemplate">wcf\system\package\plugin\ACPTemplatePackageInstallationPlugin</pip>
                <pip name="clipboardAction">wcf\system\package\plugin\ClipboardActionPackageInstallationPlugin</pip>
-               <pip name="clipboardItemType">wcf\system\package\plugin\ClipboardItemTypePackageInstallationPlugin</pip>
                <pip name="coreObject">wcf\system\package\plugin\CoreObjectPackageInstallationPlugin</pip>
                <pip name="cronjob">wcf\system\package\plugin\CronjobPackageInstallationPlugin</pip>
                <pip name="eventListener">wcf\system\package\plugin\EventListenerPackageInstallationPlugin</pip>
index 451ea5971f247293ba08b945a79ee3a20fd291c5..8fd94be194d76749d439aecfa505573cd4eae952 100644 (file)
@@ -43,10 +43,10 @@ class ClipboardAction extends AbstractSecureAction {
        protected $type = '';
        
        /**
-        * clipboard item type id
+        * object type id
         * @var integer
         */
-       protected $typeID = 0;
+       protected $objectTypeID = 0;
        
        /**
         * @see wcf\action\AbstractAction::_construct()
@@ -102,7 +102,7 @@ class ClipboardAction extends AbstractSecureAction {
                $this->validate();
                
                // execute action
-               ClipboardHandler::getInstance()->{$this->action}($this->objectIDs, $this->typeID);
+               ClipboardHandler::getInstance()->{$this->action}($this->objectIDs, $this->objectTypeID);
        }
        
        /**
@@ -158,9 +158,9 @@ class ClipboardAction extends AbstractSecureAction {
                        throw new AJAXException("Clipboard action '".$this->action."' is invalid.");
                }
                
-               $this->typeID = (!empty($this->type)) ? ClipboardHandler::getInstance()->getTypeID($this->type) : null;
-               if ($this->typeID === null) {
-                       throw new AJAXException("Clipboard item type '".$this->type."' is invalid.");
+               $this->objectTypeID = (!empty($this->type)) ? ClipboardHandler::getInstance()->getObjectTypeID($this->type) : null;
+               if ($this->objectTypeID === null) {
+                       throw new AJAXException("object type '".$this->type."' is invalid.");
                }
        }
 }
diff --git a/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemType.class.php b/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemType.class.php
deleted file mode 100644 (file)
index a9fa4af..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-namespace wcf\data\clipboard\item\type;
-use wcf\data\DatabaseObject;
-
-/**
- * Represents a clipboard item type.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.clipboard.item.type
- * @category   Community Framework
- */
-class ClipboardItemType extends DatabaseObject {
-       /**
-        * @see wcf\data\DatabaseObject::$databaseTableName
-        */
-       protected static $databaseTableName = 'clipboard_item_type';
-       
-       /**
-        * @see wcf\data\DatabaseObject::$databaseTableIndexName
-        */
-       protected static $databaseTableIndexName = 'typeID';
-}
diff --git a/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeAction.class.php b/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeAction.class.php
deleted file mode 100644 (file)
index 088a3ba..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\clipboard\item\type;
-use wcf\data\AbstractDatabaseObjectAction;
-
-/**
- * Executes clipboard item type-related actions.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.clipboard.item.type
- * @category   Community Framework
- */
-class ClipboardItemTypeAction extends AbstractDatabaseObjectAction {
-       /**
-        * @see wcf\data\AbstractDatabaseObjectAction::$className
-        */
-       protected $className = 'wcf\data\clipboard\item\type\ClipboardItemTypeEditor';
-}
diff --git a/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeEditor.class.php b/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeEditor.class.php
deleted file mode 100644 (file)
index 498b543..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\clipboard\item\type;
-use wcf\data\DatabaseObjectEditor;
-
-/**
- * Provides functions to edit clipboard item types.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.clipboard.item.type
- * @category   Community Framework
- */
-class ClipboardItemTypeEditor extends DatabaseObjectEditor {
-       /**
-        * @see wcf\data\DatabaseObjectDecorator::$baseClass
-        */
-       protected static $baseClass = 'wcf\data\clipboard\item\type\ClipboardItemType';
-}
diff --git a/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeList.class.php b/wcfsetup/install/files/lib/data/clipboard/item/type/ClipboardItemTypeList.class.php
deleted file mode 100644 (file)
index 3adc7bd..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\clipboard\item\type;
-use wcf\data\DatabaseObjectList;
-
-/**
- * Represents a list of clipboard item types.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.clipboard.item.type
- * @category   Community Framework
- */
-class ClipboardItemTypeList extends DatabaseObjectList {
-       /**
-        * @see wcf\data\DatabaseObjectList::$className
-        */
-       public $className = 'wcf\data\clipboard\item\type\ClipboardItemType';
-}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/ClipboardItemTypeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ClipboardItemTypeCacheBuilder.class.php
deleted file mode 100644 (file)
index a7bc8d5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-namespace wcf\system\cache\builder;
-use wcf\data\clipboard\item\type\ClipboardItemTypeList;
-use wcf\system\package\PackageDependencyHandler;
-
-/**
- * Caches clipboard item types.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache.builder
- * @category   Community Framework
- */
-class ClipboardItemTypeCacheBuilder implements ICacheBuilder {
-       /**
-        * @see wcf\system\cache\ICacheBuilder::getData()
-        */
-       public function getData(array $cacheResource) {
-               $typeList = new ClipboardItemTypeList();
-               $typeList->getConditionBuilder()->add("clipboard_item_type.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
-               $typeList->sqlLimit = 0;
-               $typeList->readObjects();
-               
-               $data = array(
-                       'typeNames' => array(),
-                       'types' => array()
-               );
-               foreach ($typeList->getObjects() as $typeID => $type) {
-                       $data['typeNames'][$type->typeName] = $typeID;
-                       $data['types'][$typeID] = $type;
-               }
-               
-               return $data;
-       }
-}
index f3f4afacbda19bea9ad50df2d1003bdf68c804a7..25abe78625d848321d3d67bba8f86162c3879bcf 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\clipboard;
+use wcf\data\object\type\ObjectTypeCache;
 use wcf\system\cache\CacheHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
@@ -40,18 +41,21 @@ class ClipboardHandler extends SingletonFactory {
         * cached list of clipboard item types
         * @var array<array>
         */
-       protected $typeCache = null;
+       protected $cache = null;
        
        /**
         * @see wcf\system\SingletonFactory::init()
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'clipboard-itemType-'.PACKAGE_ID,
-                       WCF_DIR.'cache/cache.clipboard-itemType-'.PACKAGE_ID.'.php',
-                       'wcf\system\cache\builder\ClipboardItemTypeCacheBuilder'
+               $this->cache = array(
+                       'objectTypes' => array(),
+                       'objectTypeNames' => array()
                );
-               $this->typeCache = CacheHandler::getInstance()->get('clipboard-itemType-'.PACKAGE_ID);
+               $cache = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.clipboardItem');
+               foreach ($cache as $objectType) {
+                       $this->cache['objectTypes'][$objectType->objectTypeID] = $objectType;
+                       $this->cache['objectTypeNames'][$objectType->objectType] = $objectType->objectTypeID;
+               }
                
                CacheHandler::getInstance()->addResource(
                        'clipboard-page-'.PACKAGE_ID,
@@ -79,19 +83,19 @@ class ClipboardHandler extends SingletonFactory {
         * Marks objects as marked.
         * 
         * @param       array           $objectIDs
-        * @param       integer         $typeID
+        * @param       integer         $objectTypeID
         */
-       public function mark(array $objectIDs, $typeID) {
+       public function mark(array $objectIDs, $objectTypeID) {
                // remove existing entries first, prevents conflict with INSERT
-               $this->unmark($objectIDs, $typeID);
+               $this->unmark($objectIDs, $objectTypeID);
                
                $sql = "INSERT INTO     wcf".WCF_N."_clipboard_item
-                                       (typeID, userID, objectID)
+                                       (objectTypeID, userID, objectID)
                        VALUES          (?, ?, ?)";
                $statement = WCF::getDB()->prepareStatement($sql);
                foreach ($objectIDs as $objectID) {
                        $statement->execute(array(
-                               $typeID,
+                               $objectTypeID,
                                WCF::getUser()->userID,
                                $objectID
                        ));
@@ -102,11 +106,11 @@ class ClipboardHandler extends SingletonFactory {
         * Removes an object marking.
         * 
         * @param       array           $objectIDs
-        * @param       integer         $typeID
+        * @param       integer         $objectTypeID
         */
-       public function unmark(array $objectIDs, $typeID) {
+       public function unmark(array $objectIDs, $objectTypeID) {
                $conditions = new PreparedStatementConditionBuilder();
-               $conditions->add("typeID = ?", array($typeID));
+               $conditions->add("objectTypeID = ?", array($objectTypeID));
                $conditions->add("objectID IN (?)", array($objectIDs));
                $conditions->add("userID = ?", array(WCF::getUser()->userID));
                
@@ -122,9 +126,9 @@ class ClipboardHandler extends SingletonFactory {
         * @param       string          $typeName
         * @return      integer
         */
-       public function getTypeID($typeName) {
-               if (isset($this->typeCache['typeNames'][$typeName])) {
-                       return $this->typeCache['typeNames'][$typeName];
+       public function getObjectTypeID($typeName) {
+               if (isset($this->cache['objectTypeNames'][$typeName])) {
+                       return $this->cache['objectTypeNames'][$typeName];
                }
                
                return null;
@@ -134,11 +138,11 @@ class ClipboardHandler extends SingletonFactory {
         * Returns a type by type id.
         * 
         * @param       integer         $typeID
-        * @return      wcf\data\clipboard\item\type\ClipboardItemType
+        * @return      wcf\data\object\type\ObjectType
         */
-       public function getType($typeID) {
-               if (isset($this->typeCache['types'][$typeID])) {
-                       return $this->typeCache['types'][$typeID];
+       public function getObjectType($typeID) {
+               if (isset($this->cache['objectTypes'][$typeID])) {
+                       return $this->cache['objectTypes'][$typeID];
                }
                
                return null;
@@ -155,7 +159,7 @@ class ClipboardHandler extends SingletonFactory {
                if ($typeID !== null) $conditions->add("typeID = ?", array($typeID));
                
                // fetch object ids
-               $sql = "SELECT  typeID, objectID
+               $sql = "SELECT  objectTypeID, objectID
                        FROM    wcf".WCF_N."_clipboard_item
                        ".$conditions;
                $statement = WCF::getDB()->prepareStatement($sql);
@@ -164,30 +168,30 @@ class ClipboardHandler extends SingletonFactory {
                // group object ids by type name
                $data = array();
                while ($row = $statement->fetchArray()) {
-                       $type = $this->getType($row['typeID']);
-                       if ($type === null) {
+                       $objectType = $this->getObjectType($row['objectTypeID']);
+                       if ($objectType === null) {
                                continue;
                        }
                        
-                       if (!isset($data[$type->typeName])) {
-                               $data[$type->typeName] = array(
-                                       'className' => $type->listClassName,
+                       if (!isset($data[$objectType->objectType])) {
+                               $data[$objectType->objectType] = array(
+                                       'className' => $objectType->listClassName,
                                        'objectIDs' => array()
                                );
                        }
                        
-                       $data[$type->typeName]['objectIDs'][] = $row['objectID'];
+                       $data[$objectType->objectType]['objectIDs'][] = $row['objectID'];
                }
                
                // read objects
                $this->markedItems = array();
-               foreach ($data as $typeName => $objectData) {
+               foreach ($data as $objectType => $objectData) {
                        $objectList = new $objectData['className']();
                        $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias() . "." . $objectList->getDatabaseTableIndexName() . " IN (?)", array($objectData['objectIDs']));
                        $objectList->sqlLimit = 0;
                        $objectList->readObjects();
                        
-                       $this->markedItems[$typeName] = $objectList->getObjects();
+                       $this->markedItems[$objectType] = $objectList->getObjects();
                }
        }
        
diff --git a/wcfsetup/install/files/lib/system/package/plugin/ClipboardItemTypePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ClipboardItemTypePackageInstallationPlugin.class.php
deleted file mode 100644 (file)
index f2f74b9..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-namespace wcf\system\package\plugin;
-use wcf\system\WCF;
-
-/**
- * This PIP installs, updates or deletes clipboard item types.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage acp.package.plugin
- * @category   Community Framework
- */
-class ClipboardItemTypePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
-       /**
-        * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$className
-        */
-       public $className = 'wcf\data\clipboard\item\type\ClipboardItemTypeEditor';
-       
-       /**
-        * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
-        */
-       public $tableName = 'clipboard_item_type';
-       
-       /**
-        * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
-        */     
-       public $tagName = 'type';
-       
-       /**
-        * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
-        */
-       protected function handleDelete(array $items) {
-               $sql = "DELETE FROM     wcf".WCF_N."_".$this->tableName."
-                       WHERE           typeName = ?
-                                       AND packageID = ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               foreach ($items as $item) {
-                       $statement->execute(array(
-                               $item['attributes']['name'],
-                               $this->installation->getPackageID()
-                       ));
-               }
-       }
-       
-       /**
-        * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
-        */
-       protected function prepareImport(array $data) {
-               return array(
-                       'listClassName' => $data['elements']['listclassname'],
-                       'typeName' => $data['attributes']['name']
-               );
-       }
-       
-       /**
-        * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
-        */
-       protected function findExistingItem(array $data) {
-               $sql = "SELECT  *
-                       FROM    wcf".WCF_N."_".$this->tableName."
-                       WHERE   typeName = ?
-                               AND packageID = ?";
-               $parameters = array(
-                       $data['typeName'],
-                       $this->installation->getPackageID()
-               );
-               
-               return array(
-                       'sql' => $sql,
-                       'parameters' => $parameters
-               );
-       }
-}
index 94e0b5c36ff26259a1a84c09cb39447fb741ae5b..010c0d24a09faa0e92558938e7d2555fad5004f3 100644 (file)
@@ -112,18 +112,10 @@ CREATE TABLE wcf1_clipboard_action (
 
 DROP TABLE IF EXISTS wcf1_clipboard_item;
 CREATE TABLE wcf1_clipboard_item (
-       typeID INT(10) NOT NULL DEFAULT 0,
+       objectTypeID INT(10) NOT NULL DEFAULT 0,
        userID INT(10) NOT NULL DEFAULT 0,
-       objectID INT(10) NOT NULL DEFAULT 0
-);
-
-DROP TABLE IF EXISTS wcf1_clipboard_item_type;
-CREATE TABLE wcf1_clipboard_item_type (
-       typeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-       packageID INT(10) NOT NULL DEFAULT 0,
-       typeName VARCHAR(80) NOT NULL DEFAULT '',
-       listClassName VARCHAR(200) NOT NULL DEFAULT '',
-       UNIQUE KEY typeName (typeName)
+       objectID INT(10) NOT NULL DEFAULT 0,
+       UNIQUE KEY (objectTypeID, userID, objectID)
 );
 
 DROP TABLE IF EXISTS wcf1_clipboard_page;
@@ -751,9 +743,7 @@ ALTER TABLE wcf1_cleanup_log ADD FOREIGN KEY (packageID) REFERENCES wcf1_package
 
 ALTER TABLE wcf1_clipboard_action ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
 
-ALTER TABLE wcf1_clipboard_item ADD FOREIGN KEY (typeID) REFERENCES wcf1_clipboard_item_type (typeID) ON DELETE CASCADE;
-
-ALTER TABLE wcf1_clipboard_item_type ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+ALTER TABLE wcf1_clipboard_item ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
 
 ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (actionID) REFERENCES wcf1_clipboard_action (actionID) ON DELETE CASCADE;
 ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;