Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/setup/upgrade/1.0
diff options
context:
space:
mode:
Diffstat (limited to 'setup/upgrade/1.0')
-rw-r--r--setup/upgrade/1.0/datadict-postgres.inc.php606
-rw-r--r--setup/upgrade/1.0/flyspray-install.xml1373
-rw-r--r--setup/upgrade/1.0/upgrade.info70
-rw-r--r--setup/upgrade/1.0/upgrade.xml902
-rw-r--r--setup/upgrade/1.0/varchartotext.php17
5 files changed, 2968 insertions, 0 deletions
diff --git a/setup/upgrade/1.0/datadict-postgres.inc.php b/setup/upgrade/1.0/datadict-postgres.inc.php
new file mode 100644
index 0000000..ebcb001
--- /dev/null
+++ b/setup/upgrade/1.0/datadict-postgres.inc.php
@@ -0,0 +1,606 @@
+<?php
+
+/**
+ @version v5.20.9-flyspray 21-Dec-2016
+ @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
+ @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+
+ Set tabs to 4 for best viewing.
+
+*/
+
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
+class ADODB2_postgres extends ADODB_DataDict {
+
+ var $databaseType = 'postgres';
+ var $seqField = false;
+ var $seqPrefix = 'SEQ_';
+ var $addCol = ' ADD COLUMN';
+ var $quote = '"';
+ var $renameTable = 'ALTER TABLE %s RENAME TO %s'; // at least since 7.1
+ var $dropTable = 'DROP TABLE %s CASCADE';
+
+ function metaType($t,$len=-1,$fieldobj=false)
+ {
+ if (is_object($t)) {
+ $fieldobj = $t;
+ $t = $fieldobj->type;
+ $len = $fieldobj->max_length;
+ }
+ $is_serial = is_object($fieldobj) && !empty($fieldobj->primary_key) && !empty($fieldobj->unique) &&
+ !empty($fieldobj->has_default) && substr($fieldobj->default_value,0,8) == 'nextval(';
+
+ switch (strtoupper($t)) {
+ case 'INTERVAL':
+ case 'CHAR':
+ case 'CHARACTER':
+ case 'VARCHAR':
+ case 'NAME':
+ case 'BPCHAR':
+ if ($len <= $this->blobSize) return 'C';
+
+ case 'TEXT':
+ return 'X';
+
+ case 'IMAGE': // user defined type
+ case 'BLOB': // user defined type
+ case 'BIT': // This is a bit string, not a single bit, so don't return 'L'
+ case 'VARBIT':
+ case 'BYTEA':
+ return 'B';
+
+ case 'BOOL':
+ case 'BOOLEAN':
+ return 'L';
+
+ case 'DATE':
+ return 'D';
+
+ case 'TIME':
+ case 'DATETIME':
+ case 'TIMESTAMP':
+ case 'TIMESTAMPTZ':
+ return 'T';
+
+ case 'INTEGER': return !$is_serial ? 'I' : 'R';
+ case 'SMALLINT':
+ case 'INT2': return !$is_serial ? 'I2' : 'R';
+ case 'INT4': return !$is_serial ? 'I4' : 'R';
+ case 'BIGINT':
+ case 'INT8': return !$is_serial ? 'I8' : 'R';
+
+ case 'OID':
+ case 'SERIAL':
+ return 'R';
+
+ case 'FLOAT4':
+ case 'FLOAT8':
+ case 'DOUBLE PRECISION':
+ case 'REAL':
+ return 'F';
+
+ default:
+ return 'N';
+ }
+ }
+
+ function actualType($meta)
+ {
+ switch($meta) {
+ case 'C': return 'VARCHAR';
+ case 'XL':
+ case 'X': return 'TEXT';
+
+ case 'C2': return 'VARCHAR';
+ case 'X2': return 'TEXT';
+
+ case 'B': return 'BYTEA';
+
+ case 'D': return 'DATE';
+ case 'TS':
+ case 'T': return 'TIMESTAMP';
+
+ case 'L': return 'BOOLEAN';
+ case 'I': return 'INTEGER';
+ case 'I1': return 'SMALLINT';
+ case 'I2': return 'INT2';
+ case 'I4': return 'INT4';
+ case 'I8': return 'INT8';
+
+ case 'F': return 'FLOAT8';
+ case 'N': return 'NUMERIC';
+ default:
+ return $meta;
+ }
+ }
+
+ /**
+ * Adding a new Column
+ *
+ * reimplementation of the default function as postgres does NOT allow to set the default in the same statement
+ *
+ * @param string $tabname table-name
+ * @param string $flds column-names and types for the changed columns
+ * @return array with SQL strings
+ */
+ function addColumnSQL($tabname, $flds)
+ {
+ $tabname = $this->tableName($tabname);
+ $sql = array();
+ $not_null = false;
+ list($lines,$pkey) = $this->_genFields($flds);
+ $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' ';
+ foreach($lines as $v) {
+ if (($not_null = preg_match('/NOT NULL/i',$v))) {
+ $v = preg_replace('/NOT NULL/i','',$v);
+ }
+
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
+ list(,$colname,$default) = $matches;
+ $sql[] = $alter . str_replace('DEFAULT '.$default,'',$v);
+ $sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default;
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default;
+ }
+ // SERIAL is not a true type in PostgreSQL and is only allowed when creating a new table.
+ // See http://www.postgresql.org/docs/9.4/static/datatype-numeric.html, 8.1.4. Serial Types.
+ elseif (preg_match('/^([^ ]+) .*SERIAL/i',$v,$matches)) {
+ list(,$colname,$default) = $matches;
+ $sql[] = 'CREATE SEQUENCE '.$tabname.'_'.$colname.'_seq';
+ $sql[] = $alter.$colname.' INTEGER';
+ $sql[] = 'ALTER SEQUENCE '.$tabname.'_'.$colname.'_seq OWNED BY '.$tabname.'.'.$colname;
+ $sql[] = 'UPDATE '.$tabname.' SET '.$colname.' = nextval(\''.$tabname.'_'.$colname.'_seq\')';
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT nextval(\''.$tabname.'_'.$colname.'_seq\')';
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL';
+ $not_null = false;
+ } else {
+ $sql[] = $alter . $v;
+ }
+ if ($not_null) {
+ list($colname) = explode(' ',$v);
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL';
+ }
+ }
+ return $sql;
+ }
+
+
+ function dropIndexSQL ($idxname, $tabname = NULL)
+ {
+ return array(sprintf($this->dropIndex, $this->tableName($idxname), $this->tableName($tabname)));
+ }
+
+ /**
+ * Change the definition of one column
+ *
+ * Postgres can't do that on it's own, you need to supply the complete defintion of the new table,
+ * to allow, recreating the table and copying the content over to the new table
+ * @param string $tabname table-name
+ * @param string $flds column-name and type for the changed column
+ * @param string $tableflds complete defintion of the new table, eg. for postgres, default ''
+ * @param array/ $tableoptions options for the new table see createTableSQL, default ''
+ * @return array with SQL strings
+ */
+ /*
+ function alterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
+ {
+ if (!$tableflds) {
+ if ($this->debug) ADOConnection::outp("alterColumnSQL needs a complete table-definiton for PostgreSQL");
+ return array();
+ }
+ return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions);
+ }*/
+
+ function alterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
+ {
+ // Check if alter single column datatype available - works with 8.0+
+ $has_alter_column = 8.0 <= (float) @$this->serverInfo['version'];
+
+ if ($has_alter_column) {
+ $tabname = $this->tableName($tabname);
+ $sql = array();
+ list($lines,$pkey) = $this->_genFields($flds);
+ $set_null = false;
+ foreach($lines as $v) {
+ $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
+ if ($not_null = preg_match('/NOT NULL/i',$v)) {
+ $v = preg_replace('/NOT NULL/i','',$v);
+ }
+
+ // SERIAL is not a true type in PostgreSQL and is only allowed when creating a new table.
+ // See http://www.postgresql.org/docs/9.4/static/datatype-numeric.html, 8.1.4. Serial Types.
+ if (preg_match('/SERIAL/i',$v)) {
+ continue;
+ }
+ // this next block doesn't work - there is no way that I can see to
+ // explicitly ask a column to be null using $flds
+ else if ($set_null = preg_match('/NULL/i',$v)) {
+ // if they didn't specify not null, see if they explicitely asked for null
+ // Lookbehind pattern covers the case 'fieldname NULL datatype DEFAULT NULL'
+ // only the first NULL should be removed, not the one specifying
+ // the default value
+ $v = preg_replace('/(?<!DEFAULT)\sNULL/i','',$v);
+ }
+
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
+ $existing = $this->metaColumns($tabname);
+ list(,$colname,$default) = $matches;
+ $alter .= $colname;
+ if ($this->connection) {
+ $old_coltype = $this->connection->metaType($existing[strtoupper($colname)]);
+ }
+ else {
+ $old_coltype = $t;
+ }
+ $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
+ $t = trim(str_replace('DEFAULT '.$default,'',$v));
+
+ // Type change from bool to int
+ if ( $old_coltype == 'L' && $t == 'INTEGER' ) {
+ $sql[] = $alter . ' DROP DEFAULT';
+ $sql[] = $alter . " TYPE $t USING ($colname::BOOL)::INT";
+ $sql[] = $alter . " SET DEFAULT $default";
+ }
+ // Type change from int to bool
+ else if ( $old_coltype == 'I' && $t == 'BOOLEAN' ) {
+ if( strcasecmp('NULL', trim($default)) != 0 ) {
+ $default = $this->connection->qstr($default);
+ }
+ $sql[] = $alter . ' DROP DEFAULT';
+ $sql[] = $alter . " TYPE $t USING CASE WHEN $colname = 0 THEN false ELSE true END";
+ $sql[] = $alter . " SET DEFAULT $default";
+ }
+ // Any other column types conversion
+ else {
+ $sql[] = $alter . " TYPE $t";
+ $sql[] = $alter . " SET DEFAULT $default";
+ }
+
+ }
+ else {
+ // drop default?
+ preg_match ('/^\s*(\S+)\s+(.*)$/',$v,$matches);
+ list (,$colname,$rest) = $matches;
+ $alter .= $colname;
+ $sql[] = $alter . ' TYPE ' . $rest;
+ }
+
+# list($colname) = explode(' ',$v);
+ if ($not_null) {
+ // this does not error out if the column is already not null
+ $sql[] = $alter . ' SET NOT NULL';
+ }
+ if ($set_null) {
+ // this does not error out if the column is already null
+ $sql[] = $alter . ' DROP NOT NULL';
+ }
+ }
+ return $sql;
+ }
+
+ // does not have alter column
+ if (!$tableflds) {
+ if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL");
+ return array();
+ }
+ return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions);
+ }
+
+ /**
+ * Drop one column
+ *
+ * Postgres < 7.3 can't do that on it's own, you need to supply the complete defintion of the new table,
+ * to allow, recreating the table and copying the content over to the new table
+ * @param string $tabname table-name
+ * @param string $flds column-name and type for the changed column
+ * @param string $tableflds complete defintion of the new table, eg. for postgres, default ''
+ * @param array/ $tableoptions options for the new table see CreateTableSQL, default ''
+ * @return array with SQL strings
+ */
+ function dropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
+ {
+ $has_drop_column = 7.3 <= (float) @$this->serverInfo['version'];
+ if (!$has_drop_column && !$tableflds) {
+ if ($this->debug) ADOConnection::outp("DropColumnSQL needs complete table-definiton for PostgreSQL < 7.3");
+ return array();
+ }
+ if ($has_drop_column) {
+ return ADODB_DataDict::dropColumnSQL($tabname, $flds);
+ }
+ return $this->_recreate_copy_table($tabname,$flds,$tableflds,$tableoptions);
+ }
+
+ /**
+ * Save the content into a temp. table, drop and recreate the original table and copy the content back in
+ *
+ * We also take care to set the values of the sequenz and recreate the indexes.
+ * All this is done in a transaction, to not loose the content of the table, if something went wrong!
+ * @internal
+ * @param string $tabname table-name
+ * @param string $dropflds column-names to drop
+ * @param string $tableflds complete defintion of the new table, eg. for postgres
+ * @param array/string $tableoptions options for the new table see CreateTableSQL, default ''
+ * @return array with SQL strings
+ */
+ function _recreate_copy_table($tabname,$dropflds,$tableflds,$tableoptions='')
+ {
+ if ($dropflds && !is_array($dropflds)) $dropflds = explode(',',$dropflds);
+ $copyflds = array();
+ foreach($this->metaColumns($tabname) as $fld) {
+ if (!$dropflds || !in_array($fld->name,$dropflds)) {
+ // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one
+ if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) &&
+ in_array($fld->type,array('varchar','char','text','bytea'))) {
+ $copyflds[] = "to_number($fld->name,'S9999999999999D99')";
+ } else {
+ $copyflds[] = $fld->name;
+ }
+ // identify the sequence name and the fld its on
+ if ($fld->primary_key && $fld->has_default &&
+ preg_match("/nextval\('([^']+)'::text\)/",$fld->default_value,$matches)) {
+ $seq_name = $matches[1];
+ $seq_fld = $fld->name;
+ }
+ }
+ }
+ $copyflds = implode(', ',$copyflds);
+
+ $tempname = $tabname.'_tmp';
+ $aSql[] = 'BEGIN'; // we use a transaction, to make sure not to loose the content of the table
+ $aSql[] = "SELECT * INTO TEMPORARY TABLE $tempname FROM $tabname";
+ $aSql = array_merge($aSql,$this->dropTableSQL($tabname));
+ $aSql = array_merge($aSql,$this->createTableSQL($tabname,$tableflds,$tableoptions));
+ $aSql[] = "INSERT INTO $tabname SELECT $copyflds FROM $tempname";
+ if ($seq_name && $seq_fld) { // if we have a sequence we need to set it again
+ $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence
+ $aSql[] = "SELECT setval('$seq_name',MAX($seq_fld)) FROM $tabname";
+ }
+ $aSql[] = "DROP TABLE $tempname";
+ // recreate the indexes, if they not contain one of the droped columns
+ foreach($this->metaIndexes($tabname) as $idx_name => $idx_data)
+ {
+ if (substr($idx_name,-5) != '_pkey' && (!$dropflds || !count(array_intersect($dropflds,$idx_data['columns'])))) {
+ $aSql = array_merge($aSql,$this->createIndexSQL($idx_name,$tabname,$idx_data['columns'],
+ $idx_data['unique'] ? array('UNIQUE') : False));
+ }
+ }
+ $aSql[] = 'COMMIT';
+ return $aSql;
+ }
+
+ function dropTableSQL($tabname)
+ {
+ $sql = ADODB_DataDict::dropTableSQL($tabname);
+
+ $drop_seq = $this->_dropAutoIncrement($tabname);
+ if ($drop_seq) $sql[] = $drop_seq;
+
+ return $sql;
+ }
+
+ // return string must begin with space
+ function _createSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
+ {
+ if ($fautoinc) {
+ $ftype = 'SERIAL';
+ return '';
+ }
+ $suffix = '';
+ if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
+ if ($fnotnull) $suffix .= ' NOT NULL';
+ if ($fconstraint) $suffix .= ' '.$fconstraint;
+ return $suffix;
+ }
+
+ // search for a sequece for the given table (asumes the seqence-name contains the table-name!)
+ // if yes return sql to drop it
+ // this is still necessary if postgres < 7.3 or the SERIAL was created on an earlier version!!!
+ function _dropAutoIncrement($tabname)
+ {
+ $tabname = $this->connection->quote('%'.$tabname.'%');
+
+ $seq = $this->connection->getOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'");
+
+ // check if a tables depends on the sequenz and it therefor cant and dont need to be droped separatly
+ if (!$seq || $this->connection->getOne("SELECT relname FROM pg_class JOIN pg_depend ON pg_class.relfilenode=pg_depend.objid WHERE relname='$seq' AND relkind='S' AND deptype='i'")) {
+ return False;
+ }
+ return "DROP SEQUENCE ".$seq;
+ }
+
+ function renameTableSQL($tabname,$newname)
+ {
+ if (!empty($this->schema)) {
+ $rename_from = $this->tableName($tabname);
+ $schema_save = $this->schema;
+ $this->schema = false;
+ $rename_to = $this->tableName($newname);
+ $this->schema = $schema_save;
+ return array (sprintf($this->renameTable, $rename_from, $rename_to));
+ }
+
+ return array (sprintf($this->renameTable, $this->tableName($tabname),$this->tableName($newname)));
+ }
+
+ /*
+ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name (
+ { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ]
+ | table_constraint } [, ... ]
+ )
+ [ INHERITS ( parent_table [, ... ] ) ]
+ [ WITH OIDS | WITHOUT OIDS ]
+ where column_constraint is:
+ [ CONSTRAINT constraint_name ]
+ { NOT NULL | NULL | UNIQUE | PRIMARY KEY |
+ CHECK (expression) |
+ REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ]
+ [ ON DELETE action ] [ ON UPDATE action ] }
+ [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+ and table_constraint is:
+ [ CONSTRAINT constraint_name ]
+ { UNIQUE ( column_name [, ... ] ) |
+ PRIMARY KEY ( column_name [, ... ] ) |
+ CHECK ( expression ) |
+ FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
+ [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] }
+ [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+ */
+
+
+ /*
+ CREATE [ UNIQUE ] INDEX index_name ON table
+[ USING acc_method ] ( column [ ops_name ] [, ...] )
+[ WHERE predicate ]
+CREATE [ UNIQUE ] INDEX index_name ON table
+[ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] )
+[ WHERE predicate ]
+ */
+ function _indexSQL($idxname, $tabname, $flds, $idxoptions)
+ {
+ $sql = array();
+
+ if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
+ $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
+ if ( isset($idxoptions['DROP']) )
+ return $sql;
+ }
+
+ if ( empty ($flds) ) {
+ return $sql;
+ }
+
+ $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
+
+ $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' ';
+
+ if (isset($idxoptions['HASH']))
+ $s .= 'USING HASH ';
+
+ if ( isset($idxoptions[$this->upperName]) )
+ $s .= $idxoptions[$this->upperName];
+
+ if ( is_array($flds) )
+ $flds = implode(', ',$flds);
+ $s .= '(' . $flds . ')';
+ $sql[] = $s;
+
+ return $sql;
+ }
+
+ function _getSize($ftype, $ty, $fsize, $fprec)
+ {
+ if (strlen($fsize) && $ty != 'X' && $ty != 'B' && $ty != 'I' && strpos($ftype,'(') === false) {
+ $ftype .= "(".$fsize;
+ if (strlen($fprec)) $ftype .= ",".$fprec;
+ $ftype .= ')';
+ }
+ return $ftype;
+ }
+
+ /**
+ "Florian Buzin [ easywe ]" <florian.buzin#easywe.de>
+
+ This function changes/adds new fields to your table. You don't
+ have to know if the col is new or not. It will check on its own.
+ */
+ function changeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)
+ {
+ global $ADODB_FETCH_MODE;
+
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+ if ($this->connection->fetchMode !== false) $savem = $this->connection->setFetchMode(false);
+
+ // check table exists
+ $save_handler = $this->connection->raiseErrorFn;
+ $this->connection->raiseErrorFn = '';
+ $cols = $this->metaColumns($tablename);
+ $this->connection->raiseErrorFn = $save_handler;
+
+ if (isset($savem)) $this->connection->setFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+
+ if ( empty($cols)) {
+ return $this->createTableSQL($tablename, $flds, $tableoptions);
+ }
+
+ $addedcols = array();
+ $modifiedcols = array();
+
+ if (is_array($flds)) {
+ // Cycle through the update fields, comparing
+ // existing fields to fields to update.
+ // if the Metatype and size is exactly the
+ // same, ignore - by Mark Newham
+ foreach($flds as $k=>$v) {
+ if ( isset($cols[$k]) && is_object($cols[$k]) ) {
+ // If already not allowing nulls, then don't change
+ $obj = $cols[$k];
+ if (isset($obj->not_null) && $obj->not_null)
+ $v = str_replace('NOT NULL','',$v);
+ if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT']))
+ $v = str_replace('AUTOINCREMENT','',$v);
+
+ $c = $cols[$k];
+ $ml = $c->max_length;
+ $mt = $this->metaType($c->type,$ml);
+
+ if (isset($c->scale)) $sc = $c->scale;
+ else $sc = 99; // always force change if scale not known.
+
+ if ($sc == -1) $sc = false;
+ list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']);
+
+ if ($ml == -1) $ml = '';
+ if ($mt == 'X') $ml = $v['SIZE'];
+ if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
+ $modifiedcols[$k] = $v;
+ }
+ } else {
+ $addedcols[$k] = $v;
+ }
+ }
+ }
+
+
+ $sql = array();
+ $sql = $this->addColumnSQL($tablename, $addedcols);
+
+ // already exists, alter table instead
+ list($lines,$pkey,$idxs) = $this->_genFields($modifiedcols);
+ // genfields can return FALSE at times
+ if ($lines == null) $lines = array();
+
+ $holdflds = array();
+ foreach ( $lines as $id => $v ) {
+ if ( isset($cols[$id]) && is_object($cols[$id]) ) {
+
+ $flds = lens_ParseArgs($v,',');
+
+ // We are trying to change the size of the field, if not allowed, simply ignore the request.
+ // $flds[1] holds the type, $flds[2] holds the size -postnuke addition
+ if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)
+ && (isset($flds[0][2]) && is_numeric($flds[0][2]))) {
+ if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1]));
+ #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>";
+ continue;
+ }
+ $holdflds[] = $modifiedcols[$id];
+ }
+ }
+ $modifiedcols = $holdflds;
+ $sql += $this->alterColumnSQL($tablename, $modifiedcols);
+
+ if ($dropOldFlds) {
+ $alter = 'ALTER TABLE ' . $this->tableName($tablename);
+ foreach ( $cols as $id => $v )
+ if ( !isset($lines[$id]) )
+ $sql[] = $alter . $this->dropCol . ' ' . $v->name;
+ }
+ return $sql;
+ }
+}
diff --git a/setup/upgrade/1.0/flyspray-install.xml b/setup/upgrade/1.0/flyspray-install.xml
new file mode 100644
index 0000000..ee7102b
--- /dev/null
+++ b/setup/upgrade/1.0/flyspray-install.xml
@@ -0,0 +1,1373 @@
+<?xml version="1.0"?>
+<schema version="0.3">
+ <table name="user_emails">
+ <descr>multiple addresses for users. subject to change in FS1.1+!</descr>
+ <field name="id" type="I" size="5"></field>
+ <field name="email_address" type="C" size="100"></field>
+ <field name="oauth_uid" type="C" size="255">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_provider" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ </table>
+ <table name="tags">
+ <desc>Do not use this table. pre FS1.0-beta table</desc>
+ <field name="task_id" type="I" size="5"></field>
+ <field name="tag" type="C" size="100"></field>
+ </table>
+ <table name="admin_requests">
+ <descr>Pending requests for admins and PMs to attend to</descr>
+ <field name="request_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="submitted_by" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="request_type" type="I" size="2">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="reason_given" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="time_submitted" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="resolved_by" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="time_resolved" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="deny_reason" type="C" size="255" />
+ <index name="resolved_project">
+ <col>resolved_by</col>
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="assigned">
+ <descr>Who is assigned what task</descr>
+ <field name="assigned_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_user">
+ <UNIQUE/>
+ <col>task_id</col>
+ <col>user_id</col>
+ </index>
+ </table>
+ <table name="attachments">
+ <descr>List the names and locations of files attached to tasks</descr>
+ <field name="attachment_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="comment_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="orig_name" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="file_name" type="C" size="30">
+ <NOTNULL/>
+ </field>
+ <field name="file_type" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="file_size" type="I" size="20">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="added_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_attachments">
+ <col>task_id</col>
+ <col>comment_id</col>
+ </index>
+ </table>
+ <table name="cache">
+ <descr>Table to cache RSS/Atom feeds</descr>
+ <field name="id" type="I" size="6">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="type" type="C" size="4">
+ <NOTNULL/>
+ </field>
+ <field name="content" type="XL">
+ <NOTNULL/>
+ </field>
+ <field name="topic" type="I" size="11">
+ <NOTNULL/>
+ </field>
+ <field name="last_updated" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="max_items" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="cache_type">
+ <UNIQUE/>
+ <col>type</col>
+ <col>topic</col>
+ <col>project_id</col>
+ <col>max_items</col>
+ </index>
+ <index name="cache_type_topic">
+ <col>type</col>
+ <col>topic</col>
+ </index>
+ </table>
+ <table name="comments">
+ <descr>task comments</descr>
+ <field name="comment_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="comment_text" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="last_edited_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_comments">
+ <col>task_id</col>
+ </index>
+ <index name="user_id_comments">
+ <col>user_id</col>
+ </index>
+ </table>
+ <table name="dependencies">
+ <descr>Task inter-dependencies</descr>
+ <field name="depend_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="dep_task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_deps">
+ <UNIQUE/>
+ <col>task_id</col>
+ <col>dep_task_id</col>
+ </index>
+ </table>
+ <table name="effort">
+ <descr>log of time spent on tasks</descr>
+ <field name="effort_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="start_timestamp" type="I" size="11"/>
+ <field name="end_timestamp" type="I" size="11"/>
+ <field name="effort" type="I" size="15">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_effort">
+ <col>task_id</col>
+ </index>
+ </table>
+ <table name="groups">
+ <descr>User Groups for the Flyspray bug killer</descr>
+ <field name="group_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="group_name" type="C" size="20">
+ <NOTNULL/>
+ </field>
+ <field name="group_desc" type="C" size="150">
+ <NOTNULL/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="is_admin" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="manage_project" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="open_new_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="modify_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="modify_all_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_own_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="delete_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="create_attachments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="delete_attachments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_history" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="close_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="close_other_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="assign_to_self" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="assign_others_to_self" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_to_assignees" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_reports" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_votes" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_assignments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_as_assignees" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_estimated_effort" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_current_effort_done" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="track_effort" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="group_open" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_multiple_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_roadmap" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_groups_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="group_name">
+ <UNIQUE/>
+ <col>group_name</col>
+ <col>project_id</col>
+ </index>
+ <index name="belongs_to_project">
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="history">
+ <descr>log of Flyspray activities</descr>
+ <field name="history_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="event_date" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="event_type" type="I" size="2">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="field_changed" type="C" size="50">
+ <NOTNULL/>
+ </field>
+ <field name="old_value" type="X" />
+ <field name="new_value" type="X" />
+ <index name="idx_task_id">
+ <col>task_id</col>
+ </index>
+ <index name="idx_event_date">
+ <col>event_date</col>
+ </index>
+ <index name="idx_event_type">
+ <col>event_type</col>
+ </index>
+ </table>
+ <table name="list_category">
+ <descr>hierarchic task categories</descr>
+ <field name="category_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="category_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="category_owner" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lft" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ <UNSIGNED/>
+ </field>
+ <field name="rgt" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ <UNSIGNED/>
+ </field>
+ <index name="project_id_cat">
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="list_os">
+ <descr>Operating system list for the Flyspray bug killer</descr>
+ <field name="os_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="os_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_os">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>os_name</col>
+ </index>
+ </table>
+ <table name="list_resolution">
+ <descr>task close reasons</descr>
+ <field name="resolution_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="resolution_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_res">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>resolution_name</col>
+ </index>
+ </table>
+ <table name="list_status">
+ <descr>List of possible task statuses</descr>
+ <field name="status_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="status_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_status">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>status_name</col>
+ </index>
+ </table>
+ <table name="list_tag">
+ <descr>definition of tags/labels for tasks</descr>
+ <field name="tag_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="tag_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="class" type="C" size="100"/>
+ <index name="tag_name">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>tag_name</col>
+ </index>
+ </table>
+ <table name="list_tasktype">
+ <descr>List of possible task types</descr>
+ <field name="tasktype_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="tasktype_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_tt">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>tasktype_name</col>
+ </index>
+ </table>
+ <table name="list_version">
+ <descr>list of project versions/milestones/software release versions</descr>
+ <field name="version_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="version_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="version_tense" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_version_name">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>version_name</col>
+ </index>
+ <index name="project_id_version">
+ <col>project_id</col>
+ <col>version_tense</col>
+ </index>
+ </table>
+ <table name="notification_messages">
+ <descr>Notification body and subject</descr>
+ <field name="message_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="message_subject" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="message_body" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="time_created" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ </table>
+ <table name="notification_recipients">
+ <descr>Notification recipient list</descr>
+ <field name="recipient_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="message_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_method" type="C" size="1">
+ <NOTNULL/>
+ </field>
+ <field name="notify_address" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ </table>
+ <table name="notifications">
+ <descr>Extra task notification registrations are stored here</descr>
+ <field name="notify_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_notifs">
+ <UNIQUE/>
+ <col>task_id</col>
+ <col>user_id</col>
+ </index>
+ </table>
+ <table name="prefs">
+ <descr>global settings of Flyspray</descr>
+ <field name="pref_id" type="I" size="1">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="pref_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="pref_value" type="X" />
+ </table>
+ <table name="projects">
+ <descr>project settings</descr>
+ <field name="project_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_title" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="theme_style" type="C" size="20">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_cat_owner" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="intro_message" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="project_is_active" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="visible_columns" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="visible_fields" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="others_view" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="others_viewroadmap" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="anon_open" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_email" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_jabber" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_reply" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_types" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="feed_img_url" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="feed_description" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_subject" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="lang_code" type="C" size="10">
+ <NOTNULL/>
+ </field>
+ <field name="comment_closed" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="auto_assign" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_updated" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_task" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="default_entry" type="C" size="8">
+ <NOTNULL/>
+ <DEFAULT value="index"/>
+ </field>
+ <field name="disp_intro" type="I" size="1">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="use_effort_tracking" type="I" size="1">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_due_version" type="C" size="40">
+ <NOTNULL/>
+ <DEFAULT value="Undecided"/>
+ </field>
+ <field name="pages_intro_msg" type="C" size="80">
+ <NOTNULL/>
+ <DEFAULT value="index"/>
+ </field>
+ <field name="hours_per_manday" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="estimated_effort_format" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="current_effort_done_format" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_order_by" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value="id"/>
+ </field>
+ <field name="default_order_by_dir" type="C" size="5">
+ <NOTNULL/>
+ <DEFAULT value="desc"/>
+ </field>
+ <field name="custom_style" type="C" size="32">
+ </field>
+ <field name="freetagging" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="1"/>>
+ </field>
+ </table>
+ <table name="registrations">
+ <descr>table for yet unconfirmed user registrations</descr>
+ <field name="reg_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="reg_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="confirm_code" type="C" size="20">
+ <NOTNULL/>
+ </field>
+ <field name="user_name" type="C" size="32">
+ <NOTNULL/>
+ </field>
+ <field name="real_name" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="email_address" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="jabber_id" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="notify_type" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="magic_url" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="time_zone" type="I" size="6">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ </table>
+ <table name="related">
+ <descr>contains loose task relations to another task or task duplicates</descr>
+ <field name="related_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="this_task" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="related_task" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="is_duplicate" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="this_task">
+ <UNIQUE/>
+ <col>this_task</col>
+ <col>related_task</col>
+ <col>is_duplicate</col>
+ </index>
+ </table>
+ <table name="reminders">
+ <descr>scheduled task reminders</descr>
+ <field name="reminder_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="to_user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="from_user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="start_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="how_often" type="I" size="12">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_sent" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="reminder_message" type="X">
+ <NOTNULL/>
+ </field>
+ </table>
+ <table name="searches">
+ <descr>Saves custom searches of users</descr>
+ <field name="id" type="I" size="11">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="user_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="name" type="C" size="50">
+ <NOTNULL/>
+ </field>
+ <field name="search_string" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ </table>
+ <table name="tasks">
+ <desc>main table for storing tasks</desc>
+ <field name="task_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_type" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_opened" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="opened_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="is_closed" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_closed" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closed_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closure_comment" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="item_summary" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="detailed_desc" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="item_status" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="resolution_reason" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="1"/>
+ </field>
+ <field name="product_category" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="product_version" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closedby_version" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="operating_system" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_severity" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_priority" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_edited_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_edited_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="percent_complete" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="mark_private" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="due_date" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="anon_email" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="task_token" type="C" size="32">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="supertask_id" type="I" size="10">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="list_order" type="I" size="3">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="estimated_effort" type="I" size="3">
+ <DEFAULT value="0"/>
+ </field>
+ <index name="attached_to_project">
+ <col>project_id</col>
+ </index>
+ <index name="task_severity">
+ <col>task_severity</col>
+ </index>
+ <index name="task_type">
+ <col>task_type</col>
+ </index>
+ <index name="product_category">
+ <col>product_category</col>
+ </index>
+ <index name="item_status">
+ <col>item_status</col>
+ </index>
+ <index name="is_closed">
+ <col>is_closed</col>
+ </index>
+ <index name="closedby_version">
+ <col>closedby_version</col>
+ </index>
+ <index name="due_date">
+ <col>due_date</col>
+ </index>
+ <index name="task_project_super">
+ <col>project_id</col>
+ <col>supertask_id</col>
+ </index>
+ <index name="task_super">
+ <col>supertask_id</col>
+ <col>task_id</col>
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="task_tag">
+ <desc>join table to add tags/labels to tasks</desc>
+ <field name="task_id" type="I" size="5">
+ <KEY/>
+ </field>
+ <field name="tag_id" type="I" size="5">
+ <KEY/>
+ </field>
+ <index name="task_id_tag">
+ <UNIQUE/>
+ <col>task_id</col>
+ <col>tag_id</col>
+ </index>
+ </table>
+ <table name="users">
+ <descr>user accounts of Flyspray</descr>
+ <field name="user_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="user_name" type="C" size="32">
+ <NOTNULL/>
+ </field>
+ <field name="user_pass" type="C" size="128"/>
+ <field name="real_name" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="jabber_id" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="email_address" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="notify_type" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_own" type="I" size="6">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="account_enabled" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="dateformat" type="C" size="30">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="dateformat_extended" type="C" size="30">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="magic_url" type="C" size="40">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="tasks_perpage" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="register_date" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="time_zone" type="I" size="6">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="login_attempts" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lock_until" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lang_code" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_uid" type="C" size="255">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_provider" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="profile_image" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="hide_my_email" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_online" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_login" type="I" size="11">
+ <descr>last login of a user</descr>
+ <NULL/>
+ </field>
+ <index name="user_name">
+ <UNIQUE/>
+ <col>user_name</col>
+ </index>
+ </table>
+ <table name="users_in_groups">
+ <descr>Which users are in which groups</descr>
+ <field name="record_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="user_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="group_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="group_id_uig">
+ <UNIQUE/>
+ <col>group_id</col>
+ <col>user_id</col>
+ </index>
+ <index name="user_id_uig">
+ <col>user_id</col>
+ </index>
+ </table>
+ <table name="votes">
+ <descr>votes for tasks</descr>
+ <field name="vote_id" type="I" size="11">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="user_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_votes">
+ <col>task_id</col>
+ </index>
+ </table>
+ <table name="links">
+ <descr>link a resource (e.g. an URL) with a task - in a more structured way than the task description text area.</descr>
+ <field name="link_id" type="I" size="11">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="comment_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="url" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="added_by" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NONULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_links">
+ <col>task_id</col>
+ </index>
+ </table>
+ <sql>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Admin', 'Members have unlimited access to all functionality', 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1);</query>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Developers', 'Global Developers for all projects', 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);</query>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Reporters', 'Open new tasks / add comments in all projects', 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1);</query>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Basic', 'Members can login, relying upon Project permissions only', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1);</query>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Pending', 'Users who are awaiting approval of their accounts', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);</query>
+ <query>INSERT INTO groups VALUES (DEFAULT, 'Project Managers', 'Permission to do anything related to the Default Project', 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);</query>
+ <query>INSERT INTO history VALUES (DEFAULT, 1, 1, 1130024797, 1, '', '', '');</query>
+ <query>INSERT INTO list_category VALUES (DEFAULT, 1, 'Backend / Core', 1, 0, 2, 3);</query>
+ <query>INSERT INTO list_category VALUES (DEFAULT, 0, 'root', 0, 0, 1, 2);</query>
+ <query>INSERT INTO list_category VALUES (DEFAULT, 1, 'root', 0, 0, 1, 4);</query>
+ <query>INSERT INTO list_os VALUES (DEFAULT, 1, 'All', 1, 1);</query>
+ <query>INSERT INTO list_os VALUES (DEFAULT, 1, 'Windows', 2, 1);</query>
+ <query>INSERT INTO list_os VALUES (DEFAULT, 1, 'Linux', 3, 1);</query>
+ <query>INSERT INTO list_os VALUES (DEFAULT, 1, 'Mac OS', 4, 1);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Not a bug', 1, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Won''t fix', 2, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Won''t implement', 3, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Works for me', 4, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Deferred', 5, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Duplicate', 6, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Fixed', 7, 1, 0);</query>
+ <query>INSERT INTO list_resolution VALUES (DEFAULT, 'Implemented', 8, 1, 0);</query>
+ <query>INSERT INTO list_tasktype VALUES (DEFAULT, 'Bug Report', 1, 1, 0);</query>
+ <query>INSERT INTO list_tasktype VALUES (DEFAULT, 'Feature Request', 2, 1, 0);</query>
+ <query>INSERT INTO list_version VALUES (DEFAULT, 1, 'Development', 1, 1, 2);</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('Unconfirmed', 1, 1, 0)</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('New', 2, 1, 0)</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('Assigned', 3, 1, 0)</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('Researching', 4, 1, 0)</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('Waiting on Customer', 5, 1, 0)</query>
+ <query>INSERT INTO list_status (status_name, list_position, show_in_list, project_id) VALUES ('Requires testing', 6, 1, 0)</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'fs_ver', '1.0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'logo', 'flyspray_small.png');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'gravatars', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'emailNoHTML', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'jabber_server', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'jabber_port', '5222');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'jabber_username', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'jabber_password', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'anon_group', '4');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'user_notify', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'admin_email', 'flyspray@example.com');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'lang_code', 'en');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'need_approval', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'spam_proof', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'default_project', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'default_entry', 'index');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'dateformat', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'dateformat_extended', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'anon_reg', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'global_theme', 'CleanFS');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'visible_columns', 'id category tasktype priority severity summary status progress');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'visible_fields', 'tasktype category severity priority status private assignedto reportedin dueversion duedate progress os votes');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'smtp_server', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'smtp_user', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'smtp_pass', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'page_title', 'Flyspray::');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'notify_registration', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'jabber_ssl', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'last_update_check', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'intro_message', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'cache_feeds', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'disable_lostpw', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'disable_changepw', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'days_before_alert', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'hide_emails', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'pages_welcome_msg', 'index');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'active_oauths', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'only_oauth_reg', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'enable_avatars', '1');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'max_avatar_size', '50');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'default_order_by', 'id');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'default_order_by_dir', 'desc');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'url_rewriting', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'max_vote_per_day', '2');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'votes_per_project', '10');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'custom_style', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'general_integration', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'footer_integration', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'repeat_password', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'repeat_emailaddress', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'massops', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'captcha_securimage', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'captcha_recaptcha', '0');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'captcha_recaptcha_sitekey', '');</query>
+ <query>INSERT INTO prefs VALUES (DEFAULT, 'captcha_recaptcha_secret', '');</query>
+ <query>INSERT INTO projects VALUES (DEFAULT, 'Default Project', 'CleanFS', 0, 'Welcome to your first Flyspray project! We hope that Flyspray provides you with many hours of increased productivity. If you have any issues, go to http://flyspray.org . You can customise this message [[?do=pm&amp;project=1|here]]', 1, 'id category tasktype priority severity summary status progress', 'tasktype category severity priority status private assignedto reportedin dueversion duedate progress os votes', 1, 1, 0, '', '', NULL, '0', NULL, NULL, '', 'en', 0, 0, 0, NULL, 'index', 0, 0,'Undecided', '', 0, 0, 0, 'id desc', 'DESC', '', 1 );</query>
+ <query>INSERT INTO tasks VALUES (DEFAULT, 1, 1, 1452600000, 1, 0, 0, 0, ' ', 'Sample Task', 'This isn''t a real task. You should close it and start opening some real tasks.', 2, 1, 1, 1, 0, 1, 1, 2, 0, 0, 0, 0, 0, '', '0', 0, 0, 0);</query>
+ <query>INSERT INTO users VALUES (DEFAULT, 'super', '1b3231655cebb7a1f783eddf27d254ca', 'Superuser', '', '', 0, 1, 1, '', '', '', 25, 0, 0, 0, 0, 'en', '0', '', '', 0, 0, NULL);</query>
+ <query>INSERT INTO users_in_groups VALUES (DEFAULT, 1, 1);</query>
+ </sql>
+</schema>
diff --git a/setup/upgrade/1.0/upgrade.info b/setup/upgrade/1.0/upgrade.info
new file mode 100644
index 0000000..a1510a5
--- /dev/null
+++ b/setup/upgrade/1.0/upgrade.info
@@ -0,0 +1,70 @@
+[defaultupgrade]
+1="upgrade.xml"
+2="varchartotext.php"
+
+[develupgrade]
+1="upgrade.xml"
+2="varchartotext.php"
+
+[fsprefs]
+fs_ver="1.0"
+logo="flyspray_small.png"
+jabber_server=""
+jabber_port="5222"
+jabber_username=""
+jabber_password=""
+anon_group="0"
+user_notify="1"
+admin_email="flyspray@example.com"
+lang_code="en"
+need_approval="0"
+spam_proof="1"
+default_project="1"
+default_entry="index"
+dateformat=""
+dateformat_extended=""
+anon_reg="1"
+page_title="Flyspray:: "
+notify_registration="0"
+jabber_ssl="0"
+last_update_check="0"
+cache_feeds="1"
+global_theme="CleanFS"
+visible_columns="id supertask project tasktype severity summary status progress"
+visible_fields="supertask tasktype category severity priority status private assignedto reportedin dueversion duedate progress os votes"
+smtp_server=""
+smtp_user=""
+smtp_pass=""
+lock_for="5"
+email_ssl="0"
+email_tls="0"
+gravatars="0"
+emailNoHTML="0"
+default_timezone="0"
+intro_message=""
+disable_lostpw="0"
+disable_changepw="0"
+days_before_alert="0"
+hide_emails="1"
+pages_welcome_msg="index"
+active_oauths=""
+only_oauth_reg="0"
+enable_avatars="1"
+max_avatar_size="50"
+default_order_by="id"
+default_order_by_dir="desc"
+url_rewriting="0"
+max_vote_per_day="2"
+votes_per_project="10"
+custom_style=""
+general_integration=""
+footer_integration=""
+repeat_password="0"
+repeat_emailaddress="0"
+massops="0"
+; Would like to see captchastuff be optional prefs, but
+; current upgrade logic wipes such additional prefs if not listed here too.
+captcha_securimage="0"
+captcha_recaptcha="0"
+captcha_recaptcha_sitekey=""
+captcha_recaptcha_secret=""
diff --git a/setup/upgrade/1.0/upgrade.xml b/setup/upgrade/1.0/upgrade.xml
new file mode 100644
index 0000000..0a48596
--- /dev/null
+++ b/setup/upgrade/1.0/upgrade.xml
@@ -0,0 +1,902 @@
+<?xml version="1.0"?>
+<schema version="0.3">
+ <table name="attachments">
+ <descr>List the names and locations of files attached to tasks</descr>
+ <field name="attachment_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="comment_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="orig_name" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="file_name" type="C" size="30">
+ <NOTNULL/>
+ </field>
+ <field name="file_type" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="file_size" type="I" size="20">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="added_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_attachments">
+ <col>task_id</col>
+ <col>comment_id</col>
+ </index>
+ </table>
+ <table name="cache">
+ <field name="id" type="I" size="6">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="type" type="C" size="4">
+ <NOTNULL/>
+ </field>
+ <field name="content" type="XL">
+ <NOTNULL/>
+ </field>
+ <field name="topic" type="I" size="11">
+ <NOTNULL/>
+ </field>
+ <field name="last_updated" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="max_items" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="cache_type">
+ <UNIQUE/>
+ <col>type</col>
+ <col>topic</col>
+ <col>project_id</col>
+ <col>max_items</col>
+ </index>
+ <index name="cache_type_topic">
+ <col>type</col>
+ <col>topic</col>
+ </index>
+ </table>
+ <table name="users">
+ <field name="user_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="user_name" type="C" size="32">
+ <NOTNULL/>
+ </field>
+ <field name="user_pass" type="C" size="128"/>
+ <field name="real_name" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="jabber_id" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="email_address" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="notify_type" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_own" type="I" size="6">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="account_enabled" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="dateformat" type="C" size="30">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="dateformat_extended" type="C" size="30">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="magic_url" type="C" size="40">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="tasks_perpage" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="register_date" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="time_zone" type="I" size="6">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="login_attempts" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lock_until" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lang_code" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_uid" type="C" size="255">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_provider" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="profile_image" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="hide_my_email" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_online" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_login" type="I" size="11">
+ <descr>last login of a user</descr>
+ <NULL/>
+ </field>
+ <index name="user_name">
+ <UNIQUE/>
+ <col>user_name</col>
+ </index>
+ </table>
+ <table name="user_emails">
+ <field name="id" type="I" size="5"></field>
+ <field name="email_address" type="C" size="100"></field>
+ <field name="oauth_uid" type="C" size="255">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="oauth_provider" type="C" size="10">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ </table>
+ <table name="effort">
+ <field name="effort_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="user_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="start_timestamp" type="I" size="11"/>
+ <field name="end_timestamp" type="I" size="11"/>
+ <field name="effort" type="I" size="15">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_effort">
+ <col>task_id</col>
+ </index>
+ </table>
+ <table name="groups">
+ <field name="group_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="group_name" type="C" size="20">
+ <NOTNULL/>
+ </field>
+ <field name="group_desc" type="C" size="150">
+ <NOTNULL/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="is_admin" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="manage_project" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="open_new_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="modify_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="modify_all_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_own_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="delete_comments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="create_attachments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="delete_attachments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_history" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="close_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="close_other_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="assign_to_self" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="assign_others_to_self" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_to_assignees" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_reports" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_votes" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="edit_assignments" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_as_assignees" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_estimated_effort" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_current_effort_done" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="track_effort" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="group_open" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="add_multiple_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_roadmap" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_own_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="view_groups_tasks" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="group_name">
+ <UNIQUE/>
+ <col>group_name</col>
+ <col>project_id</col>
+ </index>
+ <index name="belongs_to_project">
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="prefs">
+ <descr>global settings of Flyspray</descr>
+ <field name="pref_id" type="I" size="1">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="pref_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="pref_value" type="X" />
+ </table>
+ <table name="projects">
+ <field name="project_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_title" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="theme_style" type="C" size="20">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_cat_owner" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="intro_message" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="project_is_active" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="visible_columns" type="C" size="255">
+ <NOTNULL/>
+ </field>
+ <field name="visible_fields" type="C" size="255">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="others_view" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="others_viewroadmap" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="anon_open" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="notify_email" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_jabber" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_reply" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_types" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="feed_img_url" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="feed_description" type="X">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="notify_subject" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="lang_code" type="C" size="10">
+ <NOTNULL/>
+ </field>
+ <field name="comment_closed" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="auto_assign" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_updated" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_task" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="default_entry" type="C" size="8">
+ <NOTNULL/>
+ <DEFAULT value="index"/>
+ </field>
+ <field name="disp_intro" type="I" size="1">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="use_effort_tracking" type="I" size="1">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_due_version" type="C" size="40">
+ <NOTNULL/>
+ <DEFAULT value="Undecided"/>
+ </field>
+ <field name="pages_intro_msg" type="C" size="80">
+ <NOTNULL/>
+ <DEFAULT value="index"/>
+ </field>
+ <field name="hours_per_manday" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="estimated_effort_format" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="current_effort_done_format" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="default_order_by" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value="id"/>
+ </field>
+ <field name="default_order_by_dir" type="C" size="5">
+ <NOTNULL/>
+ <DEFAULT value="desc"/>
+ </field>
+ <field name="custom_style" type="C" size="32">
+ </field>
+ <field name="freetagging" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ </table>
+ <table name="tasks">
+ <field name="task_id" type="I" size="10">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_type" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_opened" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="opened_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="is_closed" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_closed" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closed_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closure_comment" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="item_summary" type="C" size="100">
+ <NOTNULL/>
+ </field>
+ <field name="detailed_desc" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="item_status" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="resolution_reason" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="1"/>
+ </field>
+ <field name="product_category" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="product_version" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="closedby_version" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="operating_system" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_severity" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="task_priority" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_edited_by" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="last_edited_time" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="percent_complete" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="mark_private" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="due_date" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="anon_email" type="C" size="100">
+ <NOTNULL/>
+ <DEFAULT value=""/>
+ </field>
+ <field name="task_token" type="C" size="32">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="supertask_id" type="I" size="10">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="list_order" type="I" size="3">
+ <DEFAULT value="0"/>
+ </field>
+ <field name="estimated_effort" type="I" size="3">
+ <DEFAULT value="0"/>
+ </field>
+ <index name="attached_to_project">
+ <col>project_id</col>
+ </index>
+ <index name="task_severity">
+ <col>task_severity</col>
+ </index>
+ <index name="task_type">
+ <col>task_type</col>
+ </index>
+ <index name="product_category">
+ <col>product_category</col>
+ </index>
+ <index name="item_status">
+ <col>item_status</col>
+ </index>
+ <index name="is_closed">
+ <col>is_closed</col>
+ </index>
+ <index name="closedby_version">
+ <col>closedby_version</col>
+ </index>
+ <index name="due_date">
+ <col>due_date</col>
+ </index>
+ <index name="task_project_super">
+ <col>project_id</col>
+ <col>supertask_id</col>
+ <col>list_order</col>
+ </index>
+ <index name="task_super">
+ <col>supertask_id</col>
+ <col>list_order</col>
+ </index>
+ </table>
+ <table name="links">
+ <field name="link_id" type="I" size="11">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="task_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="comment_id" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="url" type="X">
+ <NOTNULL/>
+ </field>
+ <field name="added_by" type="I" size="11">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="date_added" type="I" size="11">
+ <NONULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="task_id_links">
+ <col>task_id</col>
+ </index>
+ </table>
+ <table name="tags">
+ <field name="task_id" type="I" size="5"></field>
+ <field name="tag" type="C" size="100"></field>
+ </table>
+ <table name="list_category">
+ <field name="category_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="category_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="category_owner" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="lft" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ <UNSIGNED/>
+ </field>
+ <field name="rgt" type="I" size="10">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ <UNSIGNED/>
+ </field>
+ <index name="project_id_cat">
+ <col>project_id</col>
+ </index>
+ </table>
+ <table name="list_os">
+ <field name="os_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="os_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_os">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>os_name</col>
+ </index>
+ </table>
+ <table name="list_resolution">
+ <field name="resolution_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="resolution_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_res">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>resolution_name</col>
+ </index>
+ </table>
+ <table name="list_status">
+ <field name="status_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="status_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_status">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>status_name</col>
+ </index>
+ </table>
+ <table name="list_tag">
+ <field name="tag_id" type="I" size="5">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="5">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="tag_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="class" type="C" size="100"/>
+ <index name="project_id_tag">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>tag_name</col>
+ </index>
+ </table>
+ <table name="list_tasktype">
+ <field name="tasktype_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="tasktype_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_tt">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>tasktype_name</col>
+ </index>
+ </table>
+ <table name="list_version">
+ <field name="version_id" type="I" size="3">
+ <KEY/>
+ <AUTOINCREMENT/>
+ </field>
+ <field name="project_id" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="version_name" type="C" size="40">
+ <NOTNULL/>
+ </field>
+ <field name="list_position" type="I" size="3">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="show_in_list" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <field name="version_tense" type="I" size="1">
+ <NOTNULL/>
+ <DEFAULT value="0"/>
+ </field>
+ <index name="project_id_version_name">
+ <UNIQUE/>
+ <col>project_id</col>
+ <col>version_name</col>
+ </index>
+ <index name="project_id_version">
+ <col>project_id</col>
+ <col>version_tense</col>
+ </index>
+ </table>
+ <table name="task_tag">
+ <field name="task_id" type="I" size="5">
+ <KEY/>
+ </field>
+ <field name="tag_id" type="I" size="5">
+ <KEY/>
+ </field>
+ <index name="task_id_tag">
+ <UNIQUE/>
+ <col>task_id</col>
+ <col>tag_id</col>
+ </index>
+ </table>
+ <sql>
+ <query>UPDATE projects SET visible_fields = 'tasktype category severity priority status private assignedto reportedin dueversion duedate progress os votes' WHERE visible_fields = ''</query>
+ <query>UPDATE projects SET theme_style = 'CleanFS'</query>
+ <query>UPDATE prefs SET pref_value = 'CleanFS' WHERE pref_name = 'global_theme'</query>
+ </sql>
+</schema>
diff --git a/setup/upgrade/1.0/varchartotext.php b/setup/upgrade/1.0/varchartotext.php
new file mode 100644
index 0000000..3bba5ea
--- /dev/null
+++ b/setup/upgrade/1.0/varchartotext.php
@@ -0,0 +1,17 @@
+<?php
+if ($conf['database']['dbtype'] == 'pgsql') {
+ $db->query('ALTER TABLE {prefs} ALTER COLUMN pref_value TYPE text');
+ $db->query('ALTER TABLE {prefs} ALTER COLUMN pref_value SET DEFAULT \'\'');
+}
+elseif($db->dbtype=='mysqli' || $db->dbtype=='mysql') {
+ $sinfo=$db->dblink->serverInfo();
+ if(isset($sinfo['version']) && version_compare($sinfo['version'], '5.5.3')>=0 ){
+ $db->query('ALTER TABLE {prefs} CHANGE `pref_value` `pref_value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL');
+ }else{
+ $db->query('ALTER TABLE {prefs} CHANGE `pref_value` `pref_value` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL');
+ }
+}
+else{
+ $db->query('ALTER TABLE {prefs} CHANGE `pref_value` `pref_value` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL');
+}
+?>