Browse Source

Fixing Database naming

Julio Montoya 11 years ago
parent
commit
be92284fbf
1 changed files with 10 additions and 11 deletions
  1. 10 11
      plugin/ticket/database.php

+ 10 - 11
plugin/ticket/database.php

@@ -2,7 +2,7 @@
 /**
  * Contains the SQL for the tickets management plugin database structure
  */
-$table = Database::get_main_table('ticket_assigned_log');
+$table = Database::get_main_table(TABLE_SUPPORT_ASSIGNED_LOG);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         ticket_id int UNSIGNED DEFAULT NULL,
@@ -13,8 +13,8 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         KEY FK_ticket_assigned_log (ticket_id))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_category');
-$sql = "CREATE TABLE ".$table." (
+$table = Database::get_main_table(TABLE_SUPPORT_CATEGORY);
+$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         category_id char(3) NOT NULL,
         project_id char(3) NOT NULL,
@@ -29,8 +29,8 @@ $sql = "CREATE TABLE ".$table." (
         PRIMARY KEY (iid))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_message');
-$sql = "CREATE TABLE ".$table." (
+$table = Database::get_main_table(TABLE_SUPPORT_MESSAGE);
+$sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         message_id int UNSIGNED NOT NULL,
         ticket_id int UNSIGNED NOT NULL,
         subject varchar(150) DEFAULT NULL,
@@ -45,8 +45,7 @@ $sql = "CREATE TABLE ".$table." (
         KEY FK_tick_message (ticket_id) )";
 Database::query($sql);
 
-
-$table = Database::get_main_table('ticket_message_attch');
+$table = Database::get_main_table(TABLE_SUPPORT_MESSAGE_ATTACHMENTS);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         message_attch_id char(2) NOT NULL,
@@ -63,7 +62,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         KEY ticket_message_id_fk (message_id))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_priority');
+$table = Database::get_main_table(TABLE_SUPPORT_PRIORITY);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         priority_id char(3) NOT NULL,
@@ -78,7 +77,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         PRIMARY KEY (iid))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_project');
+$table = Database::get_main_table(TABLE_SUPPORT_PROJECT);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         project_id char(3) NOT NULL,
@@ -93,7 +92,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         PRIMARY KEY (iid))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_status');
+$table = Database::get_main_table(TABLE_SUPPORT_STATUS);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         iid int unsigned not null,
         status_id char(3) NOT NULL,
@@ -102,7 +101,7 @@ $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         PRIMARY KEY (iid))";
 Database::query($sql);
 
-$table = Database::get_main_table('ticket_ticket');
+$table = Database::get_main_table(TABLE_SUPPORT_TICKET);
 $sql = "CREATE TABLE IF NOT EXISTS ".$table." (
         ticket_id int UNSIGNED NOT NULL AUTO_INCREMENT,
         ticket_code char(12) DEFAULT NULL,