diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php
index 0e7772306..003515c6c 100644
--- a/system/dbupdate_3.3.php
+++ b/system/dbupdate_3.3.php
@@ -268,6 +268,72 @@ if($result = $db->db_query("SELECT view_definition FROM information_schema.views
}
}
+// Creates table system.tbl_udf if it doesn't exist and grants privileges
+if(!$result = @$db->db_query("SELECT 1 FROM system.tbl_udf LIMIT 1"))
+{
+ $qry = '
+ CREATE TABLE system.tbl_udf (
+ "schema" VARCHAR(32) NOT NULL,
+ "table" VARCHAR(128) NOT NULL,
+ "jsons" JSONB NOT NULL,
+ CONSTRAINT tbl_udf_pkey PRIMARY KEY("schema", "table")
+ );';
+ if(!$db->db_query($qry))
+ echo 'system.tbl_udf: '.$db->db_last_error().'
';
+ else
+ echo '
system.tbl_udf table created';
+
+ $qry = 'COMMENT ON COLUMN system.tbl_udf.schema IS \'Schema of the table\';';
+ if(!$db->db_query($qry))
+ echo 'Adding comment to system.tbl_udf.schema: '.$db->db_last_error().'
';
+ else
+ echo '
Added comment to system.tbl_udf.schema';
+
+ $qry = 'COMMENT ON COLUMN system.tbl_udf.table IS \'Table name\';';
+ if(!$db->db_query($qry))
+ echo 'Adding comment to system.tbl_udf.table: '.$db->db_last_error().'
';
+ else
+ echo '
Added comment to system.tbl_udf.table';
+
+ $qry = 'COMMENT ON COLUMN system.tbl_udf.jsons IS \'JSON schema\';';
+ if(!$db->db_query($qry))
+ echo 'Adding comment to system.tbl_udf.jsons: '.$db->db_last_error().'
';
+ else
+ echo '
Added comment to system.tbl_udf.jsons';
+
+ $qry = 'GRANT SELECT ON TABLE system.tbl_udf TO web;';
+ if(!$db->db_query($qry))
+ echo 'system.tbl_udf: '.$db->db_last_error().'
';
+ else
+ echo '
Granted privileges to web on system.tbl_udf';
+
+ $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_udf TO vilesci;';
+ if(!$db->db_query($qry))
+ echo 'system.tbl_udf: '.$db->db_last_error().'
';
+ else
+ echo '
Granted privileges to vilesci on system.tbl_udf';
+}
+
+// Add column udf_values to public.tbl_person
+if(!$result = @$db->db_query("SELECT udf_values FROM public.tbl_person LIMIT 1"))
+{
+ $qry = 'ALTER TABLE public.tbl_person ADD COLUMN udf_values JSONB;';
+ if(!$db->db_query($qry))
+ echo 'public.tbl_person: '.$db->db_last_error().'
';
+ else
+ echo '
Added column udf_values to table public.tbl_person';
+}
+
+// Add column udf_values to public.tbl_prestudent
+if(!$result = @$db->db_query("SELECT udf_values FROM public.tbl_prestudent LIMIT 1"))
+{
+ $qry = 'ALTER TABLE public.tbl_prestudent ADD COLUMN udf_values JSONB;';
+ if(!$db->db_query($qry))
+ echo 'public.tbl_prestudent: '.$db->db_last_error().'
';
+ else
+ echo '
Added column udf_values to table public.tbl_prestudent';
+}
+
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '