* Convert datetime to datetime(0) for dm when install zentao.
This commit is contained in:
@@ -459,13 +459,6 @@ class dbh
|
||||
$sql = preg_replace('/\,\s*(unique|fulltext)*\s+key[\_\"0-9a-z ]+\(+[\,\_\"0-9a-z ]+\)+/i', '', $sql);
|
||||
$sql = preg_replace('/ float\s*\(+[\,\_\"0-9a-z ]+\)+/i', ' float', $sql);
|
||||
|
||||
/* Convert "date" datetime to "date" datetime(0) to fix bug 25725, dm database datetime default 6 */
|
||||
preg_match_all('/"[0-9a-zA-Z]+" datetime/', $sql, $datetimeMatch);
|
||||
if(!empty($datetimeMatch))
|
||||
{
|
||||
foreach($datetimeMatch[0] as $match) $sql = str_replace($match, $match . '(0)', $sql);
|
||||
}
|
||||
|
||||
/* If table has datas and sql no default values defined, replace NOT NULL to NULL. */
|
||||
if(strpos($sql, "NOT NULL") !== false && strpos($sql, "DEFAULT") === false) $sql = str_replace("NOT NULL", "NULL", $sql);
|
||||
$sql = $this->convertAlterTableSql($sql);
|
||||
|
||||
@@ -423,6 +423,16 @@ class installModel extends model
|
||||
$table = str_replace('`ztv_', $this->config->db->name . '.`ztv_', $table);
|
||||
$table = str_replace('zt_', $this->config->db->prefix, $table);
|
||||
|
||||
if($this->config->db->driver != 'mysql')
|
||||
{
|
||||
/* Convert "date" datetime to "date" datetime(0) to fix bug 25725, dm database datetime default 6 */
|
||||
preg_match_all('/"[0-9a-zA-Z]+" datetime/', $table, $datetimeMatch);
|
||||
if(!empty($datetimeMatch))
|
||||
{
|
||||
foreach($datetimeMatch[0] as $match) $table = str_replace($match, $match . '(0)', $table);
|
||||
}
|
||||
}
|
||||
|
||||
$this->dbh->exec($table);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user