diff --git a/system/checksystem.php b/system/checksystem.php
index d0eba78f2..d6d80f5b5 100644
--- a/system/checksystem.php
+++ b/system/checksystem.php
@@ -28,13 +28,46 @@
require ('../vilesci/config.inc.php');
// Datenbank Verbindung
-//if (!$conn = pg_pconnect("host=.technikum-wien.at dbname= user= password="))
-if (!$conn = pg_pconnect(CONN_STRING))
+if (!$conn = pg_pconnect("host=calva.technikum-wien.at dbname=vilesci user=pam password=jfie02"))
+//if (!$conn = pg_pconnect(CONN_STRING))
die('Es konnte keine Verbindung zum Server aufgebaut werden!'.pg_last_error($conn));
echo '
Systemcheck!
';
echo 'DB-Updates!
';
+// ************* Moodle **********************************************************
+if (!@pg_query($conn,'SELECT * FROM lehre.tbl_moodle LIMIT 1;'))
+{
+ $sql=' CREATE TABLE lehre.tbl_moodle
+ (
+ "moodle_id" Serial NOT NULL,
+ "mdl_course_id" bigint NOT NULL,
+ "lehreinheit_id" integer,
+ "lehrveranstaltung_id" integer ,
+ "studiensemester_kurzbz" Varchar(16) ,
+ "insertamum" Timestamp Default now(),
+ "insertvon" Varchar(16),
+ constraint "pk_tbl_moodle" primary key ("moodle_id")
+ );
+
+ Alter table lehre.tbl_moodle add Constraint "lehreinheit_moodle" foreign key ("lehreinheit_id") references "lehre"."tbl_lehreinheit" ("lehreinheit_id") on update cascade on delete restrict;
+ Alter table lehre.tbl_moodle add Constraint "studiensemester_moodle" foreign key ("studiensemester_kurzbz") references "public"."tbl_studiensemester" ("studiensemester_kurzbz") on update cascade on delete restrict;
+ Alter table lehre.tbl_moodle add Constraint "lehrveranstaltung_moodle" foreign key ("lehrveranstaltung_id") references "lehre"."tbl_lehrveranstaltung" ("lehrveranstaltung_id") on update cascade on delete restrict;
+
+ Grant select on lehre.tbl_moodle to group "admin";
+ Grant update on lehre.tbl_moodle to group "admin";
+ Grant delete on lehre.tbl_moodle to group "admin";
+ Grant insert on lehre.tbl_moodle to group "admin";
+ Grant select on lehre.tbl_moodle to group "web";
+ Grant update on lehre.tbl_moodle to group "web";
+ Grant insert on lehre.tbl_moodle to group "web";
+ ';
+ if (!pg_query($conn,$sql))
+ echo 'lehre.tbl_moodle: '.pg_last_error($conn).'
';
+ else
+ echo 'Tabelle lehre.tbl_moodle hinzugefuegt!
';
+}
+
// ************* Newssprache **********************************************************
if (!@pg_query($conn,'SELECT * FROM campus.tbl_newssprache LIMIT 1;'))
{
@@ -104,6 +137,20 @@ if (!@pg_query($conn,'SELECT schule FROM public.tbl_firma LIMIT 1;'))
echo 'schule wurde bei public.tbl_firma hinzugefuegt!
';
}
+// ************** public.tbl_studiengang.moodle ************************
+if (!@pg_query($conn,'SELECT moodle FROM public.tbl_studiengang LIMIT 1;'))
+{
+ $sql=' ALTER TABLE public.tbl_studiengang ADD COLUMN moodle boolean;
+ UPDATE public.tbl_studiengang SET moodle=TRUE;
+ ALTER TABLE public.tbl_studiengang ALTER COLUMN moodle SET NOT NULL;
+ ALTER TABLE public.tbl_studiengang ALTER COLUMN moodle SET DEFAULT TRUE;
+ ';
+ if (!@pg_query($conn,$sql))
+ echo 'public.tbl_studiengang: '.pg_last_error($conn).'
';
+ else
+ echo 'moodle wurde bei public.tbl_studiengang hinzugefuegt!
';
+}
+
// ************** campus.tbl_news.datum_bis ************************
if (!@pg_query($conn,'SELECT datum_bis FROM campus.tbl_news LIMIT 1;'))
{