adding app related columns to devices table; index; and adjust surrounding code