|
@@ 1404-1412 (lines=9) @@
|
| 1401 |
|
and is_array($desc['field']) |
| 1402 |
|
) { |
| 1403 |
|
foreach ($desc['field'] as $c => $d) { |
| 1404 |
|
if (preg_match(",^(tinytext|mediumtext|text|longtext|varchar|char),i", $d) |
| 1405 |
|
and stripos($d, "NOT NULL") !== false |
| 1406 |
|
and stripos($d, "DEFAULT") === false |
| 1407 |
|
/* pas touche aux cles primaires */ |
| 1408 |
|
and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1409 |
|
) { |
| 1410 |
|
spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1411 |
|
spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
| 1412 |
|
} |
| 1413 |
|
if (preg_match(",^(INTEGER),i", $d) |
| 1414 |
|
and stripos($d, "NOT NULL") !== false |
| 1415 |
|
and stripos($d, "DEFAULT") === false |
|
@@ 1413-1421 (lines=9) @@
|
| 1410 |
|
spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1411 |
|
spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
| 1412 |
|
} |
| 1413 |
|
if (preg_match(",^(INTEGER),i", $d) |
| 1414 |
|
and stripos($d, "NOT NULL") !== false |
| 1415 |
|
and stripos($d, "DEFAULT") === false |
| 1416 |
|
/* pas touche aux cles primaires */ |
| 1417 |
|
and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1418 |
|
) { |
| 1419 |
|
spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1420 |
|
spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
| 1421 |
|
} |
| 1422 |
|
if (preg_match(",^(datetime),i", $d) |
| 1423 |
|
and stripos($d, "NOT NULL") !== false |
| 1424 |
|
and stripos($d, "DEFAULT") === false |
|
@@ 1422-1430 (lines=9) @@
|
| 1419 |
|
spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1420 |
|
spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
| 1421 |
|
} |
| 1422 |
|
if (preg_match(",^(datetime),i", $d) |
| 1423 |
|
and stripos($d, "NOT NULL") !== false |
| 1424 |
|
and stripos($d, "DEFAULT") === false |
| 1425 |
|
/* pas touche aux cles primaires */ |
| 1426 |
|
and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1427 |
|
) { |
| 1428 |
|
spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1429 |
|
spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
| 1430 |
|
} |
| 1431 |
|
} |
| 1432 |
|
|
| 1433 |
|
return array(" OK "); |