From aa1875b30a1531e7e8fb909f5468317914f629ed Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 May 2005 23:47:06 +0000 Subject: [PATCH] r196: Renaming some tables and dropping some unused fields. --- admin/fields.php | 26 +++++++++++++------------- docs/schema_changes.sql | 5 ++--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/admin/fields.php b/admin/fields.php index 313d9a2..453aaa2 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -35,15 +35,15 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { $admin->error(phrase('error_invalid_id')); } - $db->query("DELETE FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = $field[fieldid]"); - $db->query("ALTER TABLE " . TABLE_PREFIX . "bugvalues DROP $field[shortname]"); - $db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bugvalues"); + $db->query("DELETE FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = $field[fieldid]"); + $db->query("ALTER TABLE " . TABLE_PREFIX . "bugvaluefill DROP $field[shortname]"); + $db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bugvaluefill"); $admin->redirect('fields.php?do=modify', 'The field has been successfully removed from the system.'); } @@ -52,7 +52,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { $admin->error(phrase('error_invalid_id')); @@ -72,7 +72,7 @@ if ($_REQUEST['do'] == 'update') if ($bugsys->in['fieldid']) { - $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { $admin->error(phrase('error_invalid_id')); @@ -135,13 +135,13 @@ if ($_REQUEST['do'] == 'update') if ($add) { - if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE shortname = '" . $bugsys->in['shortname'] . "'") OR $bugsys->in['shortname'] == 'bugid') + if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE shortname = '" . $bugsys->in['shortname'] . "'") OR $bugsys->in['shortname'] == 'bugid') { $admin->error('That short name is already in use, please change it so it is unique.'); } $db->query(" - INSERT INTO bugfields + INSERT INTO bugfield (shortname, name, description, type, required, private, $extrafields) VALUES ('" . $bugsys->in['shortname'] . "', '" . $bugsys->in['name'] . "', @@ -150,13 +150,13 @@ if ($_REQUEST['do'] == 'update') )" ); - $db->query("ALTER TABLE " . TABLE_PREFIX . "bugvalues ADD " . $bugsys->in['shortname'] . " MEDIUMTEXT NOT NULL"); - $db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bugvalues"); + $db->query("ALTER TABLE " . TABLE_PREFIX . "bugvaluefill ADD " . $bugsys->in['shortname'] . " MEDIUMTEXT NOT NULL"); + $db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bugvaluefill"); } else { $db->query(" - UPDATE " . TABLE_PREFIX . "bugfields + UPDATE " . TABLE_PREFIX . "bugfield SET name = '" . $bugsys->in['name'] . "', description = '" . $bugsys->in['description'] . "', required = " . intval($bugsys->in['required']) . ", @@ -197,7 +197,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($edit) { - $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . intval($bugsys->in['fieldid'])); if (!$field) { $admin->error(phrase('error_invalid_id')); @@ -286,7 +286,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_head(phrase('additional_bug_fields'), 3); $admin->table_column_head(array('Display Name/Description', 'Short Name/Field ID', 'Actions')); - $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfields ORDER BY fieldid ASC"); + $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); while ($field = $db->fetch_array($fields)) { $admin->row_multi_item( diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index c7835c3..df7f777 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -29,7 +29,7 @@ CREATE TABLE `history` ( PRIMARY KEY (`historyid`) ); -CREATE TABLE `bugfields` ( +CREATE TABLE `bugfield` ( `fieldid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `shortname` VARCHAR(100) NOT NULL, `name` VARCHAR(255) NOT NULL, @@ -38,7 +38,6 @@ CREATE TABLE `bugfields` ( `selects` MEDIUMTEXT NOT NULL, `required` INT(2) NOT NULL, `private` INT(2) NOT NULL, - `usereditable` INT(2) NOT NULL, `regexmatch` MEDIUMTEXT NOT NULL, `defaultvalue` MEDIUMTEXT NOT NULL, `usedefault` INT(2) NOT NULL, @@ -46,7 +45,7 @@ CREATE TABLE `bugfields` ( PRIMARY KEY (`fieldid`) ); -CREATE TABLE `bugvalues` ( +CREATE TABLE `bugvaluefill` ( `bugid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`bugid`) ); \ No newline at end of file -- 2.43.5