Skip to content

Commit a54f781

Browse files
committed
fix(Install): reoder upgrade steps
1 parent c4a0be3 commit a54f781

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

install/migration/update_1.1.0_to_1.2.0/02_update_tables_schema.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@
3030
* -------------------------------------------------------------------------
3131
*/
3232

33-
use GlpiPlugin\Carbon\Location;
34-
use GlpiPlugin\Carbon\Source;
35-
3633
/** @var DBmysql $DB */
3734
/** @var Migration $migration */
3835

39-
$table = (new DbUtils())->getTableForItemType(Source::class);
36+
$table = 'glpi_plugin_carbon_sources';
4037
$migration->addField(
4138
$table,
4239
'is_carbon_intensity_source',
@@ -48,7 +45,7 @@
4845
]
4946
);
5047

51-
$table = (new DbUtils())->getTableForItemType(Location::class);
48+
$table = 'glpi_plugin_carbon_locations';
5249
$migration->addField(
5350
$table,
5451
'plugin_carbon_sources_zones_id',

install/migration/update_1.1.0_to_1.2.0/03_RTE_zone.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232

3333
use GlpiPlugin\Carbon\Install;
3434

35-
/** @var DbMysql $DB */
36-
global $DB;
35+
/** @var Migration $migration */
36+
/** @var DBmysql $DB */
3737

38+
// Force immediate migration of this table to let the subsequent code work
39+
// with the up to date schema
3840
$rte_source = Install::getOrCreateSource('RTE', 0, 1);
3941
$france_zone = Install::getOrCreateZone('France', $rte_source);
4042
Install::linkSourceZone($rte_source, $france_zone);

0 commit comments

Comments
 (0)