Fix: missing tinyint
This commit is contained in:
parent
7d5c4a3b38
commit
2240dd4ac6
@ -967,7 +967,9 @@ class DoliDBMssql
|
|||||||
{
|
{
|
||||||
$sql = "ALTER TABLE ".$table;
|
$sql = "ALTER TABLE ".$table;
|
||||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||||
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
|
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||||
|
$sql.="(".$field_desc['value'].")";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
if (! $this->query($sql))
|
if (! $this->query($sql))
|
||||||
|
|||||||
@ -1010,9 +1010,11 @@ class DoliDBMysql
|
|||||||
{
|
{
|
||||||
$sql = "ALTER TABLE ".$table;
|
$sql = "ALTER TABLE ".$table;
|
||||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||||
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
|
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||||
|
$sql.="(".$field_desc['value'].")";
|
||||||
|
}
|
||||||
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
||||||
if (! $this->query($sql))
|
if (! $this->query($sql))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1004,9 +1004,11 @@ class DoliDBMysqli
|
|||||||
{
|
{
|
||||||
$sql = "ALTER TABLE ".$table;
|
$sql = "ALTER TABLE ".$table;
|
||||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||||
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
|
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||||
|
$sql.="(".$field_desc['value'].")";
|
||||||
|
}
|
||||||
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
||||||
if (! $this->query($sql))
|
if (! $this->query($sql))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -297,7 +297,7 @@ class DoliDBPgsql
|
|||||||
// To have postgresql case sensitive
|
// To have postgresql case sensitive
|
||||||
$line=str_replace(' LIKE \'',' ILIKE \'',$line);
|
$line=str_replace(' LIKE \'',' ILIKE \'',$line);
|
||||||
$line=str_replace(' LIKE BINARY \'',' LIKE \'',$line);
|
$line=str_replace(' LIKE BINARY \'',' LIKE \'',$line);
|
||||||
|
|
||||||
// Delete using criteria on other table must not declare twice the deleted table
|
// Delete using criteria on other table must not declare twice the deleted table
|
||||||
// DELETE FROM tabletodelete USING tabletodelete, othertable -> DELETE FROM tabletodelete USING othertable
|
// DELETE FROM tabletodelete USING tabletodelete, othertable -> DELETE FROM tabletodelete USING othertable
|
||||||
if (preg_match('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i',$line,$reg))
|
if (preg_match('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i',$line,$reg))
|
||||||
@ -1219,11 +1219,13 @@ class DoliDBPgsql
|
|||||||
{
|
{
|
||||||
$sql = "ALTER TABLE ".$table;
|
$sql = "ALTER TABLE ".$table;
|
||||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||||
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
|
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||||
|
$sql.="(".$field_desc['value'].")";
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME May not work with pgsql. May need to run a second request. If it works, just remove the FIXME tag
|
// FIXME May not work with pgsql. May need to run a second request. If it works, just remove the FIXME tag
|
||||||
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL";
|
||||||
|
|
||||||
dol_syslog($sql,LOG_DEBUG);
|
dol_syslog($sql,LOG_DEBUG);
|
||||||
if (! $this->query($sql))
|
if (! $this->query($sql))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1153,7 +1153,9 @@ class DoliDBSqlite
|
|||||||
{
|
{
|
||||||
$sql = "ALTER TABLE ".$table;
|
$sql = "ALTER TABLE ".$table;
|
||||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||||
if ($field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') $sql.="(".$field_desc['value'].")";
|
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
|
||||||
|
$sql.="(".$field_desc['value'].")";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
|
||||||
if (! $this->query($sql))
|
if (! $this->query($sql))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user