lehre.tbl_pruefung - db changes

This commit is contained in:
Andreas Moik
2016-04-22 14:22:30 +02:00
parent 975ab02d74
commit 958ec7f81a
2 changed files with 649 additions and 629 deletions
+628 -628
View File
File diff suppressed because it is too large Load Diff
+21 -1
View File
@@ -43,6 +43,7 @@ array
array("schema" => "public", "name" => "tbl_studentlehrverband", "from" => "student_uid", "to" => "prestudent_id", "datatype" => "int", "newTarget" => "tbl_prestudent", "newTargetSchema" => "public", "pickDataFrom" => "tbl_student", "pickDataFromCol" => "student_uid", "constraint" => "SET NOT NULL"),
array("schema" => "lehre", "name" => "tbl_projektarbeit", "from" => "student_uid", "to" => "prestudent_id", "datatype" => "int", "newTarget" => "tbl_prestudent", "newTargetSchema" => "public", "pickDataFrom" => "tbl_student", "pickDataFromCol" => "student_uid", "constraint" => "SET NOT NULL"),
array("schema" => "fue", "name" => "tbl_ressource", "from" => "student_uid", "to" => "uid", "datatype" => "varchar(32)", "newTarget" => "tbl_benutzer", "newTargetSchema" => "public", "pickDataFrom" => "tbl_benutzer", "pickDataFromCol" => "uid" , "constraint" => ""),
array("schema" => "lehre", "name" => "tbl_pruefung", "from" => "student_uid", "to" => "prestudent_id", "datatype" => "int", "newTarget" => "tbl_prestudent", "newTargetSchema" => "public", "pickDataFrom" => "tbl_student", "pickDataFromCol" => "student_uid", "constraint" => "SET NOT NULL"),
);
if(!isset($_POST["action"]))
@@ -401,6 +402,25 @@ else if($_POST["action"] == "Starten")
echo '</body></html>';
/* FUNCTIONS */
@@ -491,7 +511,7 @@ function modifyOneTable($db, $table)
//constraints: $TO FK, $TO
if($table["constraint"] != "")
$constraint_qry = 'ALTER TABLE '.$table["schema"].".".$table["name"].' ALTER COLUMN '.$table["to"].' '.$table["constraint"];
$constraint_qry = 'ALTER TABLE '.$table["schema"].".".$table["name"].' ALTER COLUMN '.$table["to"].' '.$table["constraint"].";";
$constraint_qry.=' ALTER TABLE '.$table["schema"].".".$table["name"].' ADD CONSTRAINT fk_'.$table["name"].'_'.$table["newTarget"].'_'.$table["to"].' FOREIGN KEY ('.$table["to"].') REFERENCES '.$table["newTargetSchema"].'.'.$table["newTarget"].' ('.$table["to"].');';