def initializeRoomBookingDB(location, force=False): """ Modifies Indico main database. - location list Creates necessary branches in room booking database. - rooms branch - bookings branch - several indexes """ indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() root = DALManagerCERN().getRoot() # 1. Location ----------------------------------------------------------- initialLocation = Location(location, FactoryCERN) if force or not indicoRoot.has_key('RoomBookingLocationList'): indicoRoot['RoomBookingLocationList'] = [initialLocation] if force or not indicoRoot.has_key('DefaultRoomBookingLocation'): indicoRoot['DefaultRoomBookingLocation'] = location # 2. Rooms & Bookings --------------------------------------------------- # Create rooms branch if force or not root.has_key('Rooms'): root['Rooms'] = IOBTree() # Create reservations branch if force or not root.has_key('Reservations'): root['Reservations'] = IOBTree() # Create blocking branch if force or not root.has_key('RoomBlocking'): root['RoomBlocking'] = OOBTree() root['RoomBlocking']['Blockings'] = IOBTree() root['RoomBlocking']['Indexes'] = OOBTree() root['RoomBlocking']['Indexes']['OwnerBlockings'] = OOBTree() root['RoomBlocking']['Indexes']['DayBlockings'] = CalendarDayIndex() root['RoomBlocking']['Indexes']['RoomBlockings'] = OOBTree() # Create indexes if force or not root.has_key('RoomReservationsIndex'): root['RoomReservationsIndex'] = OOBTree() if force or not root.has_key('UserReservationsIndex'): root['UserReservationsIndex'] = OOBTree() if force or not root.has_key('DayReservationsIndex'): root['DayReservationsIndex'] = OOBTree() if force or not root.has_key('RoomDayReservationsIndex'): root['RoomDayReservationsIndex'] = OOBTree() # Create possible equipment branch if force or not root.has_key('EquipmentList'): root['EquipmentList'] = {} # update Catalog with new rb indexes Catalog.updateDB() DALManagerCERN().commit()
def initializeRoomBookingDB(location, force=False): """ Modifies Indico main database. - location list Creates necessary branches in room booking database. - rooms branch - bookings branch - several indexes """ indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() root = DALManagerCERN().getRoot() # 1. Location ----------------------------------------------------------- initialLocation = Location(location, FactoryCERN) if force or not indicoRoot.has_key("RoomBookingLocationList"): indicoRoot["RoomBookingLocationList"] = [initialLocation] if force or not indicoRoot.has_key("DefaultRoomBookingLocation"): indicoRoot["DefaultRoomBookingLocation"] = location # 2. Rooms & Bookings --------------------------------------------------- # Create rooms branch if force or not root.has_key("Rooms"): root["Rooms"] = IOBTree() # Create reservations branch if force or not root.has_key("Reservations"): root["Reservations"] = IOBTree() # Create blocking branch if force or not root.has_key("RoomBlocking"): root["RoomBlocking"] = OOBTree() root["RoomBlocking"]["Blockings"] = IOBTree() root["RoomBlocking"]["Indexes"] = OOBTree() root["RoomBlocking"]["Indexes"]["OwnerBlockings"] = OOBTree() root["RoomBlocking"]["Indexes"]["DayBlockings"] = CalendarDayIndex() root["RoomBlocking"]["Indexes"]["RoomBlockings"] = OOBTree() # Create indexes if force or not root.has_key("RoomReservationsIndex"): root["RoomReservationsIndex"] = OOBTree() if force or not root.has_key("UserReservationsIndex"): root["UserReservationsIndex"] = OOBTree() if force or not root.has_key("DayReservationsIndex"): root["DayReservationsIndex"] = OOBTree() if force or not root.has_key("RoomDayReservationsIndex"): root["RoomDayReservationsIndex"] = OOBTree() # Create possible equipment branch if force or not root.has_key("EquipmentList"): root["EquipmentList"] = {} # update Catalog with new rb indexes Catalog.updateDB() DALManagerCERN().commit()
def catalogMigration(dbi, withRBDB, prevVersion): """ Initializing/updating index catalog """ PluginsHolder().reloadAllPlugins(disable_if_broken=False) skip = False for plugin in (p for p in PluginsHolder().getList() if isinstance(p, Plugin) or isinstance(p, PluginType)): if plugin.isActive() and not plugin.isUsable(): print console.colored( "\r Plugin '{0}' is going to be disabled: {1}".format( plugin.getName(), plugin.getNotUsableReason() ), 'yellow') skip = True if skip and not console.yesno('\r Do you want to continue the migration anyway?'): raise ControlledExit() Catalog.updateDB(dbi=dbi)
def catalogMigration(dbi, prevVersion): """ Initializing/updating index catalog """ PluginsHolder().reloadAllPlugins(disable_if_broken=False) skip = False for plugin in (p for p in PluginsHolder().getList() if isinstance(p, Plugin) or isinstance(p, PluginType)): if plugin.isActive() and not plugin.isUsable(): print console.colored( "\r Plugin '{0}' is going to be disabled: {1}".format( plugin.getName(), plugin.getNotUsableReason() ), 'yellow') skip = True if skip and not console.yesno('\r Do you want to continue the migration anyway?'): raise ControlledExit() Catalog.updateDB(dbi=dbi)
def catalogMigration(dbi, withRBDB, prevVersion): """ Initializing/updating index catalog """ Catalog.updateDB(dbi=dbi)