mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
update(Dashboard DataStructure Migration): adds migration file to change all old datastructures from the dashboard.tbl_dashboard_preset
This commit is contained in:
@@ -74,6 +74,8 @@ require_once('dbupdate_3.4/55968_index_anrechnung.php');
|
||||
require_once('dbupdate_3.4/25999_locale_update.php');
|
||||
require_once('dbupdate_3.4/55289_pep_fine_tuning.php');
|
||||
require_once('dbupdate_3.4/55614_perm_verwaltetoe.php');
|
||||
require_once('dbupdate_3.4/61730_Dashboard_Anpassungen.php');
|
||||
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
$result = @$db->db_query("SELECT preset_id FROM dashboard.tbl_dashboard_preset WHERE preset ? 'widgets'");
|
||||
$result_num_rows = $db->db_num_rows($result);
|
||||
$errorList = array();
|
||||
for($i = 0; $i < $result_num_rows; $i++)
|
||||
{
|
||||
$row = $db->db_fetch_object($result, $i);
|
||||
|
||||
$qry = "
|
||||
UPDATE dashboard.tbl_dashboard_preset
|
||||
SET preset =
|
||||
COALESCE(
|
||||
(SELECT jsonb_object_agg(keys,values) FROM (
|
||||
SELECT key AS keys,jsonb_build_object('widgets',to_jsonb(value)) AS values
|
||||
FROM jsonb_each(preset->'widgets')
|
||||
) AS subquery
|
||||
),preset)
|
||||
WHERE preset_id = ".$row->preset_id;
|
||||
|
||||
$db->db_query($qry);
|
||||
if (!$db->db_query($qry))
|
||||
array_push($errorList,'<br><strong>dashboard.tbl_dashboard_preset: ' . $db->db_last_error() . '</strong><br>') ;
|
||||
|
||||
}
|
||||
|
||||
if(empty($errorList)){
|
||||
echo '<br>successfully updated dashboard.tbl_dashboard_preset';
|
||||
}
|
||||
else{
|
||||
foreach($errorList as $error){
|
||||
echo $error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user