Fix #5661 - MTrack - daily email large and no branch
authorAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 10:18:37 +0000 (18:18 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 10:18:37 +0000 (18:18 +0800)
15 files changed:
DataObjects/Mtrack_change.php
DataObjects/Mtrack_repos.php
DataObjects/Mtrack_repos_branch.php [new file with mode: 0644]
DataObjects/mtrack.sql
sql/cash_invoice_entry.sql [new file with mode: 0644]
sql/mtrack_change.sql [new file with mode: 0644]
sql/mtrack_change_audit.sql [new file with mode: 0644]
sql/mtrack_clcache.sql [new file with mode: 0644]
sql/mtrack_jira.sql [new file with mode: 0644]
sql/mtrack_jira_object.sql [new file with mode: 0644]
sql/mtrack_milestone.sql [new file with mode: 0644]
sql/mtrack_repos.sql [new file with mode: 0644]
sql/mtrack_repos_branch.sql [new file with mode: 0644]
sql/mtrack_ticket.sql [new file with mode: 0644]
sql/mtrack_wiki.sql [new file with mode: 0644]

index e1f2113..b090ed8 100644 (file)
@@ -276,6 +276,7 @@ class Pman_MTrack_DataObjects_Mtrack_change extends DB_DataObject
         $tc->ontable = 'mtrack_repos';
         $tc->onid = $checker->repo->id;
         $tc->rev= $rev;
+        $tc->branch = $ce->branch;
         if ($tc->count()) { // if we have already tracked this..
             return false;
         }
@@ -306,7 +307,7 @@ class Pman_MTrack_DataObjects_Mtrack_change extends DB_DataObject
         $this->changedate = date('Y-m-d H:i:s', $ce->ctime);
         $this->reason = $ce->changelog;
         $this->person_id = $ce->changeby_id;
-        
+        $this->branch = $ce->branch;
         $this->rev = $rev;
         $this->insert();
         
@@ -347,6 +348,8 @@ class Pman_MTrack_DataObjects_Mtrack_change extends DB_DataObject
          
         if ($obj->tableName() == 'mtrack_ticket') {
             $obj = $obj->project();
+        } else {
+            $obj = $obj->branchObject($this->branch);
         }
         if ($obj) {
          
index 03f6621..60d01bf 100644 (file)
@@ -439,7 +439,19 @@ class Pman_MTrack_DataObjects_Mtrack_repos extends DB_DataObject
     }
     
     
-    
+    function branchObject($n)
+    {
+        // create or return branch dataobject
+        $b = DB_DataObject::factory('mtrack_repos_branch');
+        $b->repo_id = $this->id;
+        $b->name = $n;
+        if ($b->find(true)) {
+            return $b;
+        }
+        $b->insert();
+        return $b;
+        
+    }
     
     // these should really be phased out, and the Controlers use impl()-> directly..
     function getBranches()
@@ -781,12 +793,16 @@ class Pman_MTrack_DataObjects_Mtrack_repos extends DB_DataObject
         
         //print_r($last);exit;
         $body = '';
-     
+        $len = 0;
         foreach($obj->summary as $file=>$who) { 
             $res = $this->impl()->diff($file, $last ? $last->rev : $first->rev, $last ? $first->rev : null);
             //print_r($res);
             //$lines = $this->parseDiff($res);
             $lines = stream_get_contents($res);
+            $len += strlen($lines);
+            if ($len > 2000000) {
+                $lines = "Too large see repo";
+            }
             
             if (preg_match('/\.map$/', $file)) {
                 $lines = "Changed";
@@ -837,23 +853,41 @@ class Pman_MTrack_DataObjects_Mtrack_repos extends DB_DataObject
         
         //$this->impl()->debug=1;
         //print_r(array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'));
-        $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
-         
-        // find the last rev the day before...
-        
+        $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), 'rev', '--all');
         
-        
-        $obj = $this->historyToSummary($res, $notify->act_start);
-        if (!$obj) {
-           // echo "History returned nothing";
-            return true;
+        $branches = array();
+        foreach($res as $r) {
+            if (!preg_match('#^refs/heads/.*$#', $r->branch)) {
+                continue;
+            }
+            $br = preg_replace('#^refs/heads/.*$#', $r->branch, '');
+            $branches[$br] = 1;
+                
+        }
+        $objs = array();
+        foreach($branches as $branch=>$one) {
+            
+            
+            $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
+             
+            // find the last rev the day before...
+            
+            
+             
+            $obj = $this->historyToSummary($res, $notify->act_start);
+            if (!$obj) {
+               // echo "History returned nothing";
+                return true;
+            }
+            $obj->from_dt = $start;
+            $obj->to_dt = $end;
+            $obj->branch = $br;
+            //print_r($obj);exit; 
+         
+            $objs[] = $obj;
         }
-        $obj->from_dt = $start;
-        $obj->to_dt = $end;
+        $ret =   $rcpt->buildMail('repo_daily_changes', array('branches' => $obj));
         
-        //print_r($obj);exit; 
-        $ret =   $rcpt->buildMail('repo_daily_changes', $obj);
-        //print_r($ret);exit;
         return $ret;
         
         
diff --git a/DataObjects/Mtrack_repos_branch.php b/DataObjects/Mtrack_repos_branch.php
new file mode 100644 (file)
index 0000000..cf64397
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Table Definition for mtrack_repos
+ */
+class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
+
+class Pman_MTrack_DataObjects_Mtrack_repos extends DB_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'mtrack_repos';                    // table name
+    public $id;                              // int(11)  not_null primary_key auto_increment
+    public $name;                       // string(64)  not_null
+    public $repo_id;                         // string(16)  not_null
+     
+     
+    function repo()
+    {
+        static $cache;
+        if (isset($cache[$this->repo_id])) {
+            return $cache[$this->repo_id];
+        }
+        $r = DB_DataObject::factory('mtrack_repo');
+        $r->get($this->repo_id);
+        $cache[$this->repo_id] = $r;
+        return $r;
+    }
+
+    function notifyENDOFDAYMAIL($rcpt, $last_sent_date, $notify, $force)
+    {
+        // fisrst use history to show a list of changes between the dates.
+        //die("building end of day mail");
+        // var_dump($notify->act_start );
+        $start = date('Y-m-d H:i:s', strtotime($notify->act_start . ' - 1 DAY'));
+        $end = date('Y-m-d H:i:s', strtotime($notify->act_start));
+        
+           
+        $object = 'branch';
+        $branch = $this->name;
+    
+        
+        //$this->impl()->debug=1;
+        //print_r(array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'));
+    
+         $res = $this->repo()->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
+          
+         // find the last rev the day before...
+         
+         
+          
+         $obj = $this->repo()->historyToSummary($res, $notify->act_start);
+         if (!$obj) {
+            // echo "History returned nothing";
+             return true;
+         }
+         $obj->from_dt = $start;
+         $obj->to_dt = $end;
+         $obj->branch = $this->name;
+            //print_r($obj);exit; 
+          
+       
+        $ret =   $rcpt->buildMail('repo_daily_changes', $obj);
+        
+        return $ret;
+        
+         
+         
+        
+        
+        
+    }
+     
+    
+}
\ No newline at end of file
index 06ad43e..8777819 100644 (file)
@@ -1,53 +1,11 @@
-
--- Change tracking.. - may be moved up later???
-
-
-CREATE TABLE mtrack_change_audit (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  change_id int(11) NOT NULL DEFAULT 0,
-  fieldname varchar(128) DEFAULT '',
-  action varchar(16) DEFAULT '',
-  oldvalue text,
-  value text,
-  PRIMARY KEY(id)
-) ;
-ALTER TABLE mtrack_change_audit ADD COLUMN ticket_change_id int(11) NOT NULL DEFAULT 0;
-
-ALTER TABLE mtrack_change_audit ADD INDEX change_id_lookup (change_id);
-ALTER TABLE mtrack_change_audit ADD INDEX ticket_change_id_lookup (ticket_change_id);
-
-
-
-
-CREATE TABLE mtrack_change (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  person_id int(11) DEFAULT 0,
-  ontable varchar(128) DEFAULT '',
-  onid int(11) NOT NULL DEFAULT 0,
-  changedate datetime NOT NULL,
-  rev varchar(32) NOT NULL DEFAULT '',
-  reason text ,
-  PRIMARY KEY (id)
-) ;
-
-ALTER TABLE mtrack_change ADD COLUMN rev varchar(64) NOT NULL DEFAULT '';
-
--- Caching??? - go back to file baseD?
-CREATE TABLE mtrack_clcache (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  repo_id int(11) DEFAULT NULL,
-  rev varchar(128) DEFAULT NULL,
-  sobject longtext,
-  PRIMARY KEY (id)
-) ;
+-- this stuff is not used anymore...
 
 
  
 
 
 -- Table structure for table components_by_project
-
+-- ?? not used?
 CREATE TABLE mtrack_project_reference (
    id int(11) NOT NULL AUTO_INCREMENT,
    project_id  int(11) NOT NULL,
@@ -57,29 +15,11 @@ CREATE TABLE mtrack_project_reference (
  
 
   
--- Table structure for table milestones
--- change/update etc are references to mtrack_changes
-CREATE TABLE mtrack_milestone (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  name varchar(128) DEFAULT NULL,
-  description text,
-  startdate datetime DEFAULT NULL,
-  duedate datetime DEFAULT NULL,
-  completed datetime DEFAULT NULL,
-  deleted int(11) NOT NULL DEFAULT '0',
-  created int(11) NOT NULL,
-  updated int(11) NOT NULL,
-  project_id int(11) DEFAULT 0,
-  PRIMARY KEY (id)
-);
 
-ALTER TABLE mtrack_milestone CHANGE column pmid project_id int (11) DEFAULT 0;
-ALTER TABLE mtrack_milestone CHANGE column completed completed int (11) NOT NULL DEFAULT 0;
-ALTER TABLE mtrack_milestone ADD column on_hold int (2) NOT NULL DEFAULT 0;
 
 -- reports??? - may change quite a bit later?
 -- change/update etc are references to mtrack_changes
-
+-- not used?
 CREATE TABLE mtrack_report (
   id int(11) NOT NULL AUTO_INCREMENT,
   summary varchar(128) NOT NULL,
@@ -91,24 +31,8 @@ CREATE TABLE mtrack_report (
 
 -- Table structure for table repos
 
-CREATE TABLE mtrack_repos (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  shortname varchar(64)  NOT NULL DEFAULT '',
-  scmtype varchar(16) NOT NULL DEFAULT '',
-  repopath varchar(255) NOT NULL DEFAULT '',
-  browserurl varchar(255) DEFAULT NULL DEFAULT '',
-  browsertype varchar(255) DEFAULT NULL DEFAULT '',
-  description text,
-  serverurl varchar(255) DEFAULT NULL DEFAULT '',
-  parent varchar(255) NOT NULL DEFAULT '',
-  clonedfrom int(11) DEFAULT NULL,
-  PRIMARY KEY (id)
-) ;
-ALTER TABLE mtrack_repos ADD COLUMN project_id INT(11) DEFAULT 0;
-ALTER TABLE mtrack_repos ADD INDEX plookup(project_id);
-
 
+-- not used?
 CREATE TABLE mtrack_snippet (
   id int(11) NOT NULL AUTO_INCREMENT,
   created int(11) NOT NULL DEFAULT 0,
@@ -121,14 +45,14 @@ CREATE TABLE mtrack_snippet (
 
 -- Table structure for table ticket_changeset_hashes
 
-#CREATE TABLE ticket_changeset_hashes (
-#tid char(32) NOT NULL,
-#  hash varchar(128) NOT NULL DEFAULT '',
-#  PRIMARY KEY (tid,hash)
-#) ;
+-- CREATE TABLE ticket_changeset_hashes (
+-- tid char(32) NOT NULL,
+--  hash varchar(128) NOT NULL DEFAULT '',
+--  PRIMARY KEY (tid,hash)
+--) ;
 
 -- Table structure for table ticket_components
-
+-- not used
 CREATE TABLE mtrack_ticket_reference (
    id int(11) NOT NULL AUTO_INCREMENT,
    ticket_id  int(11) NOT NULL,
@@ -138,52 +62,8 @@ CREATE TABLE mtrack_ticket_reference (
 
  
 
--- Table structure for table tickets
-
-CREATE TABLE mtrack_ticket (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  project_id int(11) NOT NULL DEFAULT 0,
-  summary longtext,
-  description longtext,
-  changelog longtext,
-  created int(11) NOT NULL DEFAULT 0,
-  updated int(11) NOT NULL DEFAULT 0,
-  owner_id int(11) NOT NULL DEFAULT 0,
-  priority_id int(11) NOT NULL DEFAULT 0,
-  severity_id int(11) NOT NULL DEFAULT 0,
-  classification_id int(11) NOT NULL DEFAULT 0,
-  resolution_id int(11) NOT NULL DEFAULT 0,
-  cc text,
-  status int(11) NOT NULL DEFAULT 0,
-  estimated double DEFAULT NULL,
-  spent double DEFAULT NULL,
-  x_fieldname text,
-  PRIMARY KEY (id)
-) ;
-ALTER TABLE mtrack_ticket ADD COLUMN project_id int(11) NOT NULL DEFAULT 0;
-ALTER TABLE mtrack_ticket ADD COLUMN developer_id int(11) NOT NULL DEFAULT 0;
-ALTER TABLE mtrack_ticket ADD COLUMN milestone_id int(11) NOT NULL DEFAULT 0;
-ALTER TABLE mtrack_ticket ADD COLUMN act_now int(11) NOT NULL DEFAULT 0;
-ALTER TABLE mtrack_ticket ADD COLUMN seqid int(11) NOT NULL DEFAULT 0;
-
-
-
-CREATE TABLE  mtrack_wiki (
-  id int(11)  NOT NULL AUTO_INCREMENT,
-  project_id int(11)  NOT NULL  DEFAULT 0,
-  path varchar(128)  NOT NULL  DEFAULT '',
-  wikidata longtext  NOT NULL,
-  created_id int(11)  NOT NULL  DEFAULT 0,
-  updated_id int(11)  NOT NULL  DEFAULT 0,
-  is_protected int(2)  NOT NULL COMMENT 'if so team only',
-  is_protected_company int(2)  NOT NULL  DEFAULT 0,
-  protected_group text  NOT NULL,
-  PRIMARY KEY (id),
-  INDEX lookup(project_id, path)
-);
-
-CREATE TABLE mtrack_desktop_activity (
+-- not used?
+ CREATE TABLE mtrack_desktop_activity (
   id int(11)  NOT NULL AUTO_INCREMENT,
   cmd_id int(11)  NOT NULL,
   title_id int(11)  NOT NULL,
@@ -202,25 +82,4 @@ CREATE TABLE  mtrack_desktop_cmd (
 ) ;
 
 
-ALTER TABLE  cash_invoice_entry ADD COLUMN `ticket_id` int(11) NOT NULL DEFAULT 0;
-
-CREATE  TABLE mtrack_jira (
-  id INT NOT NULL AUTO_INCREMENT ,
-  project_id INT(11) NOT NULL DEFAULT 0 ,
-  jira_url TEXT NOT NULL ,
-  username VARCHAR(128) NOT NULL ,
-  passwd VARCHAR(128) NOT NULL ,
-  PRIMARY KEY (id)
-);
-
-
-CREATE  TABLE  mtrack_jira_object (
-  id INT NOT NULL AUTO_INCREMENT ,
-  on_table VARCHAR(64) NOT NULL ,
-  on_id INT NOT NULL DEFAULT 0 ,
-  jira_ref VARCHAR(64) NOT NULL ,
-  PRIMARY KEY (id)
-  );
-  
- alter table  mtrack_jira_object add column jira_key VARCHAR(64) NOT NULL;
 
diff --git a/sql/cash_invoice_entry.sql b/sql/cash_invoice_entry.sql
new file mode 100644 (file)
index 0000000..962fe23
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE  cash_invoice_entry ADD COLUMN `ticket_id` int(11) NOT NULL DEFAULT 0;
diff --git a/sql/mtrack_change.sql b/sql/mtrack_change.sql
new file mode 100644 (file)
index 0000000..817ef21
--- /dev/null
@@ -0,0 +1,14 @@
+
+CREATE TABLE mtrack_change (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  person_id int(11) DEFAULT 0,
+  ontable varchar(128) DEFAULT '',
+  onid int(11) NOT NULL DEFAULT 0,
+  changedate datetime NOT NULL,
+  rev varchar(32) NOT NULL DEFAULT '',
+  reason text ,
+  PRIMARY KEY (id)
+) ;
+
+ALTER TABLE mtrack_change ADD COLUMN rev varchar(64) NOT NULL DEFAULT '';
+ALTER TABLE mtrack_change ADD COLUMN branch varchar(64) NOT NULL DEFAULT '';
diff --git a/sql/mtrack_change_audit.sql b/sql/mtrack_change_audit.sql
new file mode 100644 (file)
index 0000000..dde2446
--- /dev/null
@@ -0,0 +1,15 @@
+
+
+CREATE TABLE mtrack_change_audit (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  change_id int(11) NOT NULL DEFAULT 0,
+  fieldname varchar(128) DEFAULT '',
+  action varchar(16) DEFAULT '',
+  oldvalue text,
+  value text,
+  PRIMARY KEY(id)
+) ;
+ALTER TABLE mtrack_change_audit ADD COLUMN ticket_change_id int(11) NOT NULL DEFAULT 0;
+
+ALTER TABLE mtrack_change_audit ADD INDEX change_id_lookup (change_id);
+ALTER TABLE mtrack_change_audit ADD INDEX ticket_change_id_lookup (ticket_change_id);
diff --git a/sql/mtrack_clcache.sql b/sql/mtrack_clcache.sql
new file mode 100644 (file)
index 0000000..e80ab75
--- /dev/null
@@ -0,0 +1,10 @@
+-- Caching??? - go back to file baseD?
+CREATE TABLE mtrack_clcache (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  repo_id int(11) DEFAULT NULL,
+  rev varchar(128) DEFAULT NULL,
+  sobject longtext,
+  PRIMARY KEY (id)
+) ;
+
diff --git a/sql/mtrack_jira.sql b/sql/mtrack_jira.sql
new file mode 100644 (file)
index 0000000..214996a
--- /dev/null
@@ -0,0 +1,9 @@
+
+CREATE  TABLE mtrack_jira (
+  id INT NOT NULL AUTO_INCREMENT ,
+  project_id INT(11) NOT NULL DEFAULT 0 ,
+  jira_url TEXT NOT NULL ,
+  username VARCHAR(128) NOT NULL ,
+  passwd VARCHAR(128) NOT NULL ,
+  PRIMARY KEY (id)
+);
\ No newline at end of file
diff --git a/sql/mtrack_jira_object.sql b/sql/mtrack_jira_object.sql
new file mode 100644 (file)
index 0000000..76ef3e2
--- /dev/null
@@ -0,0 +1,10 @@
+CREATE  TABLE  mtrack_jira_object (
+  id INT NOT NULL AUTO_INCREMENT ,
+  on_table VARCHAR(64) NOT NULL ,
+  on_id INT NOT NULL DEFAULT 0 ,
+  jira_ref VARCHAR(64) NOT NULL ,
+  PRIMARY KEY (id)
+  );
+  
+ alter table  mtrack_jira_object add column jira_key VARCHAR(64) NOT NULL;
+
diff --git a/sql/mtrack_milestone.sql b/sql/mtrack_milestone.sql
new file mode 100644 (file)
index 0000000..ca15e48
--- /dev/null
@@ -0,0 +1,19 @@
+-- Table structure for table milestones
+-- change/update etc are references to mtrack_changes
+CREATE TABLE mtrack_milestone (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  name varchar(128) DEFAULT NULL,
+  description text,
+  startdate datetime DEFAULT NULL,
+  duedate datetime DEFAULT NULL,
+  completed datetime DEFAULT NULL,
+  deleted int(11) NOT NULL DEFAULT '0',
+  created int(11) NOT NULL,
+  updated int(11) NOT NULL,
+  project_id int(11) DEFAULT 0,
+  PRIMARY KEY (id)
+);
+
+ALTER TABLE mtrack_milestone CHANGE column pmid project_id int (11) DEFAULT 0;
+ALTER TABLE mtrack_milestone CHANGE column completed completed int (11) NOT NULL DEFAULT 0;
+ALTER TABLE mtrack_milestone ADD column on_hold int (2) NOT NULL DEFAULT 0;
\ No newline at end of file
diff --git a/sql/mtrack_repos.sql b/sql/mtrack_repos.sql
new file mode 100644 (file)
index 0000000..cc31fd3
--- /dev/null
@@ -0,0 +1,17 @@
+CREATE TABLE mtrack_repos (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  shortname varchar(64)  NOT NULL DEFAULT '',
+  scmtype varchar(16) NOT NULL DEFAULT '',
+  repopath varchar(255) NOT NULL DEFAULT '',
+  browserurl varchar(255) DEFAULT NULL DEFAULT '',
+  browsertype varchar(255) DEFAULT NULL DEFAULT '',
+  description text,
+  serverurl varchar(255) DEFAULT NULL DEFAULT '',
+  parent varchar(255) NOT NULL DEFAULT '',
+  clonedfrom int(11) DEFAULT NULL,
+  PRIMARY KEY (id)
+) ;
+ALTER TABLE mtrack_repos ADD COLUMN project_id INT(11) DEFAULT 0;
+ALTER TABLE mtrack_repos ADD INDEX plookup(project_id);
+
\ No newline at end of file
diff --git a/sql/mtrack_repos_branch.sql b/sql/mtrack_repos_branch.sql
new file mode 100644 (file)
index 0000000..4d4339b
--- /dev/null
@@ -0,0 +1,9 @@
+CREATE TABLE mtrack_repos_branch (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  name varchar(64)  NOT NULL DEFAULT '',
+  repo_id INT(11) NOT NULL DEFAULT 0,
+  PRIMARY KEY (id)
+) ;
+ALTER TABLE mtrack_repos_branch ADD INDEX plookup(repo_id,name);
+
\ No newline at end of file
diff --git a/sql/mtrack_ticket.sql b/sql/mtrack_ticket.sql
new file mode 100644 (file)
index 0000000..853f918
--- /dev/null
@@ -0,0 +1,30 @@
+
+-- Table structure for table tickets
+
+CREATE TABLE mtrack_ticket (
+  id int(11) NOT NULL AUTO_INCREMENT,
+  project_id int(11) NOT NULL DEFAULT 0,
+  summary longtext,
+  description longtext,
+  changelog longtext,
+  created int(11) NOT NULL DEFAULT 0,
+  updated int(11) NOT NULL DEFAULT 0,
+  owner_id int(11) NOT NULL DEFAULT 0,
+  priority_id int(11) NOT NULL DEFAULT 0,
+  severity_id int(11) NOT NULL DEFAULT 0,
+  classification_id int(11) NOT NULL DEFAULT 0,
+  resolution_id int(11) NOT NULL DEFAULT 0,
+  cc text,
+  status int(11) NOT NULL DEFAULT 0,
+  estimated double DEFAULT NULL,
+  spent double DEFAULT NULL,
+  x_fieldname text,
+  PRIMARY KEY (id)
+) ;
+ALTER TABLE mtrack_ticket ADD COLUMN project_id int(11) NOT NULL DEFAULT 0;
+ALTER TABLE mtrack_ticket ADD COLUMN developer_id int(11) NOT NULL DEFAULT 0;
+ALTER TABLE mtrack_ticket ADD COLUMN milestone_id int(11) NOT NULL DEFAULT 0;
+ALTER TABLE mtrack_ticket ADD COLUMN act_now int(11) NOT NULL DEFAULT 0;
+ALTER TABLE mtrack_ticket ADD COLUMN seqid int(11) NOT NULL DEFAULT 0;
+
diff --git a/sql/mtrack_wiki.sql b/sql/mtrack_wiki.sql
new file mode 100644 (file)
index 0000000..c271cd2
--- /dev/null
@@ -0,0 +1,14 @@
+
+CREATE TABLE  mtrack_wiki (
+  id int(11)  NOT NULL AUTO_INCREMENT,
+  project_id int(11)  NOT NULL  DEFAULT 0,
+  path varchar(128)  NOT NULL  DEFAULT '',
+  wikidata longtext  NOT NULL,
+  created_id int(11)  NOT NULL  DEFAULT 0,
+  updated_id int(11)  NOT NULL  DEFAULT 0,
+  is_protected int(2)  NOT NULL COMMENT 'if so team only',
+  is_protected_company int(2)  NOT NULL  DEFAULT 0,
+  protected_group text  NOT NULL,
+  PRIMARY KEY (id),
+  INDEX lookup(project_id, path)
+);
\ No newline at end of file