/** * Install the plugin. */ public function hookInstall() { # Create table $db = get_db(); # Dates are always "YYYY-MM-DD", i.e. 10 characters long $sql = "\n\t\tCREATE TABLE IF NOT EXISTS `{$db->DateSearchDates}` (\n\t\t\t\t`id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t`item_id` int(10) unsigned NOT NULL REFERENCES `{$db->Item}`,\n\t\t\t\t`fromdate` varchar(10) NOT NULL,\n\t\t\t\t`todate` varchar(10) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; $db->query($sql); SELF::_installOptions(); SELF::_batchProcessExistingItems(); }
/** * Install the plugin. */ public function hookInstall() { # Create table $db = get_db(); # Let's assume that a "numval" = number value is at the most "1234567890-1234-1234" == 20 chars long # And let's assume that any unit name is at the most 20 chars long ("Reichsmark" would be 10) $sql = "\n\t\tCREATE TABLE IF NOT EXISTS `{$db->RangeSearchValues}` (\n\t\t\t\t`id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t`item_id` int(10) unsigned NOT NULL REFERENCES `{$db->Item}`,\n\t\t\t\t`fromnum` varchar(20) NOT NULL,\n\t\t\t\t`tonum` varchar(20) NOT NULL,\n\t\t\t\t`unit` varchar(" . UNIT_LEN . ") NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tINDEX (unit)\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; $db->query($sql); SELF::_installOptions(); # SELF::_batchProcessExistingItems(); # Don't ... Do it only if configured. }
/** * Install the plugin. */ public function hookInstall() { # Create table $db = get_db(); $numLen = MEASUREMENTSEARCH_NUM_MAXLEN; $unitLen = MEASUREMENTSEARCH_UNIT_MAXLEN; $sql = "\r\n\t\tCREATE TABLE IF NOT EXISTS `{$db->MeasurementSearchValues}` (\r\n\t\t\t\t`id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t`item_id` int(10) unsigned NOT NULL REFERENCES `{$db->Item}`,\r\n\t\t\t\t`height` varchar({$numLen}) NOT NULL,\r\n\t\t\t\t`width` varchar({$numLen}) NOT NULL,\r\n `depth` varchar({$numLen}) NOT NULL,\r\n\t\t\t\t`unit` varchar({$unitLen}) NOT NULL,\r\n\t\t\t\tPRIMARY KEY (`id`),\r\n\t\t\t\tINDEX (unit)\r\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; $db->query($sql); SELF::_installOptions(); # SELF::_batchProcessExistingItems(); }
/** * Install the plugin. */ public function hookInstall() { SELF::_installOptions(); }