From c68c593a8cf7af49d4d08c174fd829e6ba96b2ae Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Tue, 8 Dec 2009 04:04:52 +0100 Subject: [PATCH] update script to IServ2 complained about rooms that did not exist in the current database, but in the sql dump --- maint/update-iserv1-iserv2.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/maint/update-iserv1-iserv2.pl b/maint/update-iserv1-iserv2.pl index aa97f0c..b23e17e 100755 --- a/maint/update-iserv1-iserv2.pl +++ b/maint/update-iserv1-iserv2.pl @@ -215,6 +215,14 @@ while() { print "converting the database...\n"; foreach(IServ::DB::GetArr("SELECT * FROM mod_roomreservation_bookings_old;")) { my %row = %{$_}; + + # test if room exists, if not, create it + my @room = IServ::DB::GetArr "SELECT * FROM rooms WHERE name='".$row{"room"}."';"; + if(!@room) { + print "NOTICE: room $_ was found in old database but not in current, creating it.\n"; + IServ::DB::Put "rooms", { "name" => $row{"room"} }; + } + IServ::DB::Put "mod_roomreservation_bookings", { "rrb_room" => $row{"room"}, "rrb_date" => $row{"date"}, "rrb_tsfirst" => $tsbeginoldkeys{$row{"timebegin"}}, "rrb_tslast" => -- 2.20.1