1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-18 19:23:10 +01:00

Correzione minore su namespace in aggiornamento

This commit is contained in:
Dasc3er 2020-09-24 11:15:18 +02:00
parent f4c0909425
commit 542f3035a2

View File

@ -4,6 +4,8 @@
* Creazione dei campi per l'API (created_at e updated_at) * Creazione dei campi per l'API (created_at e updated_at)
*/ */
use API\Response;
// I record precedenti vengono impostati a NULL // I record precedenti vengono impostati a NULL
$tables = include __DIR__.'/tables.php'; $tables = include __DIR__.'/tables.php';
@ -16,7 +18,7 @@ foreach ($tables as $table) {
$database->query('ALTER TABLE `'.$table.'` ADD `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP'); $database->query('ALTER TABLE `'.$table.'` ADD `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP');
} }
if (API\Response::isCompatible()) { if (Response::isCompatible()) {
$updated_at = $database->fetchArray(str_replace('|field|', 'updated_at', $query)); $updated_at = $database->fetchArray(str_replace('|field|', 'updated_at', $query));
if (empty($updated_at)) { if (empty($updated_at)) {
$database->query('ALTER TABLE `'.$table.'` ADD `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'); $database->query('ALTER TABLE `'.$table.'` ADD `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP');