Skip to content

Commit 30a02ac

Browse files
author
Carlos Garcia
committed
Añadido mensaje de error cuando el modelo falla al crear la tabla.
1 parent 84c956d commit 30a02ac

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Core/Model/Base/ModelCore.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* This file is part of FacturaScripts
4-
* Copyright (C) 2013-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
4+
* Copyright (C) 2013-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU Lesser General Public License as
@@ -25,6 +25,7 @@
2525
use FacturaScripts\Core\DbQuery;
2626
use FacturaScripts\Core\DbUpdater;
2727
use FacturaScripts\Core\Lib\Import\CSVImport;
28+
use FacturaScripts\Core\Tools;
2829

2930
/**
3031
* The class from which all models inherit, connects to the database,
@@ -140,12 +141,12 @@ public function __construct(array $data = [])
140141
throw new Exception('The table name is not defined in the model ' . $this->modelClassName());
141142
}
142143

143-
if (false === DbUpdater::isTableChecked(static::tableName())) {
144-
if (self::$dataBase->tableExists(static::tableName())) {
145-
DbUpdater::updateTable(static::tableName());
146-
} else {
147-
DbUpdater::createTable(static::tableName(), [], $this->install());
148-
}
144+
if (DbUpdater::isTableChecked(static::tableName())) {
145+
// none
146+
} elseif (self::$dataBase->tableExists(static::tableName())) {
147+
DbUpdater::updateTable(static::tableName());
148+
} elseif (false === DbUpdater::createTable(static::tableName(), [], $this->install())) {
149+
Tools::log()->critical('Failed to create table ' . static::tableName());
149150
}
150151

151152
$this->loadModelFields(self::$dataBase, static::tableName());

0 commit comments

Comments
 (0)