dbupdate entry; WIP table altering statements for lehre.tbl_projektarbeit

This commit is contained in:
Johann Hoffmann
2026-03-05 17:33:18 +01:00
parent c40fdb2c4f
commit d1af44bcdc
2 changed files with 49 additions and 0 deletions
+1
View File
@@ -92,6 +92,7 @@ require_once('dbupdate_3.4/68744_StV_settings.php');
require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php');
require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
require_once('dbupdate_3.4/75469_le_optional_4_projektarbeit.php');
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
@@ -0,0 +1,48 @@
<?php
if (! defined('DB_NAME')) exit('No direct script access allowed');
if($result = $db->db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'lehre' AND table_name = 'tbl_projektarbeit' AND column_name = 'lehrveranstaltung_id'"))
{
if($db->db_num_rows($result) === 0)
{
$qry = "ALTER TABLE lehre.tbl_projektarbeit
ADD COLUMN IF NOT EXISTS lehrveranstaltung_id INTEGER;";
if(!$db->db_query($qry))
echo '<strong>lehre.tbl_projektarbeit: '.$db->db_last_error().'</strong><br>';
else
echo '<br>tbl_projektarbeit column lehrveranstaltung_id hinzugefuegt';
}
}
// TODO: check for and add fk constraint lehrveranstaltung_id
//if($result = $db->db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'lehre' AND table_name = 'tbl_projektarbeit' AND column_name = 'lehrveranstaltung_id'"))
//{
// if($db->db_num_rows($result) === 0)
// {
//
// $qry = "ALTER TABLE lehre.tbl_projektarbeit
// ADD COLUMN IF NOT EXISTS lehrveranstaltung_id INTEGER;";
//
// if(!$db->db_query($qry))
// echo '<strong>lehre.tbl_projektarbeit: '.$db->db_last_error().'</strong><br>';
// else
// echo '<br>tbl_projektarbeit column lehrveranstaltung_id hinzugefuegt';
// }
//}
if($result = $db->db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'lehre' AND table_name = 'tbl_projektarbeit' AND column_name = 'studiensemester_kurzbz'"))
{
if($db->db_num_rows($result) === 0)
{
$qry = "ALTER TABLE lehre.tbl_projektarbeit
ADD COLUMN IF NOT EXISTS lehrveranstaltung_id INTEGER;";
if(!$db->db_query($qry))
echo '<strong>lehre.tbl_projektarbeit: '.$db->db_last_error().'</strong><br>';
else
echo '<br>tbl_projektarbeit column lehrveranstaltung_id hinzugefuegt';
}
}